Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29282 Discussions

Linking Fortran Static Libraries with C++, Argument Passing

polakse
Beginner
4,570 Views
First, a disclaimer: I know very little about Fortran and C++

I have some Fortran code that I have compiled into a multi-threaded static library. I want to call a subroutine in that Fortran code from a C++ "wrapper" application (DLL). I have been able to compile and link the Fortran and C++ code, however, when I pass arguments to the Fortran subroutine, they do not appear to be passed by reference. Here is some test code I am working with:

Fortran:
    SUBROUTINE RDNIST(FOO)
!DEC$ATTRIBUTES REFERENCE, ALIAS: "_RDNIST":: RDNIST
FOO = FOO * 2
return
END

C++:

extern "C" void __cdecl RDNIST(double *);
double bar = 3.14;
returnValues[0] = bar;
RDNIST(&bar);
returnValues[1] = bar;

Using the above code, the values of returnValues[0] and returnValues[1] are the same, both 3.14.

I have also tried using __stdcall instead of __cdecl, but the results are the same. Also, I tried compiling the Fortran lib with various calling conventions (C, REF... STDCALL, REF... etc). I have a feeling I'm missing some basic multi-language concept/rule. Any help will be greatly appreciated.

For reference, I am using MVS 2005 .NET, with IVF 9.1

Thanks!

Scott


0 Kudos
28 Replies
Steven_L_Intel1
Employee
3,336 Views
You don't need the !DEC$ ATTRIBUTES line. You do need to declare FOO as REAL(8).
0 Kudos
polakse
Beginner
3,336 Views
So simple.... yet so effective. It works now.

Thank you!
Scott
0 Kudos
polakse
Beginner
3,336 Views
Ok, one more question. You mention that I don't need the !DEC$ ATTRIBUTES line. When I remove that, I get an unresolved external error when linking the C++ code. For whatever reason, it appears that all external subroutine names are being prepended with an underscore. For instance, the external subroutine (in a Fortran lib) "foo" becomes "_foo". Is there a compiler setting (for either Fortran or C++) to change this external subroutine name decoration?

Thanks again,
Scott
0 Kudos
Steven_L_Intel1
Employee
3,336 Views
The C++ compiler should be doing the same thing. You wouldn't happen to be mixing 32 and 64-bit compilers, would you? The IA-32 convention is to prepend an underscore, the Intel 64 (EM64T) convention is to not.
0 Kudos
polakse
Beginner
3,336 Views
The C++ compiler is prepending an underscore, but it appears the Fortran compiler is not. I am using the IA-32 compiler...
C:Program FilesIntelCompilerFortran9.1IA32...

C++:
extern "C" { void __cdecl rdnist(); }

Fortran:
subroutine rdnist()
...
return
end

Error when compiling/linking the C++:
LNK2001: unresolved external symbol _rdnist

0 Kudos
Steven_L_Intel1
Employee
3,336 Views
No, the problem is that Fortran upcases the routine name. Your original post assumed that, the new example does not.
0 Kudos
polakse
Beginner
3,336 Views
Gotcha. The subroutine in the Fortran code is declared in lowercase, so I was thrown off. Now that problem is corrected, but I'm getting new unresolved externals from the Fortran lib. By the way, your help is very appreciated - you're saving me from banging my head against the keyboard.

Error 1 error LNK2001: unresolved external symbol _for_stop_core
Error 2 error LNK2001: unresolved external symbol _for_stop_core
Error 3 error LNK2001: unresolved external symbol _for_stop_core
Error 4 error LNK2001: unresolved external symbol _for_read_seq_lis
Error 5 error LNK2001: unresolved external symbol _for_close
Error 6 error LNK2001: unresolved external symbol _for_rewind
Error 7 error LNK2001: unresolved external symbol _for_read_seq_fmt
Error 8 error LNK2001: unresolved external symbol _for_write_seq_fmt
Error 9 error LNK2001: unresolved external symbol _for_open
Error 10 error LNK2001: unresolved external symbol _for_f90_index
Error 11 error LNK2001: unresolved external symbol _for_cpstr



0 Kudos
Steven_L_Intel1
Employee
3,336 Views
When you have a C main program and Fortran library, you should:

1. Tools..Options..Projects..VC++ Directories..Library Files - add path to the Intel Fortran LIB folder
2. When creating the library project, Additional options, uncheck the box which says to disable default library search rules. If the project is already created, go to the Fortran>Libraries property page and set "Disable OBJCOMMENT Library Names in Object" to No

In addition, in VS2005 you have to add the Fortran .LIB file to the C main project (either as a "source file" or on the Linker "Additional Dependencies" option.
0 Kudos
polakse
Beginner
3,336 Views
I actually already did both of those things. I'm not getting any errors about missing libraries, just those unresolved externals. Perplexing. The function/subroutine names listed as the unresolved externals are not functions/subroutines in the four Fortran source files I'm using to build the library. I'm assuming those functions/subroutines exist in some default Fortran libs?
0 Kudos
Steven_L_Intel1
Employee
3,336 Views
Yes, those are in the default Fortran libs. I still think you missed the change for the "Disable OBJCOMMENT...". If you enable the "Verbose" feature in the linker property page, you can see the list of libraries the linker is finding. The other possibility is that you are mixing 32 and 64 bit stuff.
0 Kudos
polakse
Beginner
3,336 Views
Disable OBJCOMMENT... is definitely set to "no"

I enabled the verbose setting on the c++ compiler. The output is below (sorry about the dump). I don't see anything obvious, but then, nothing about this project has been obvious to me smiley [:-)]

1>------ Rebuild All started: Project: NistWrapper, Configuration: Release Win32 ------
1>Deleting intermediate and output files for project 'NistWrapper', configuration 'Release|Win32'
1>Compiling...
1>NistWrapper.cpp
1>Linking...
1>Starting pass 1
1>Processed /DEFAULTLIB:uuid.lib
1>Processed /DEFAULTLIB:mcaduser.lib
1>Processed /DEFAULTLIB:RDNIST.lib
1>Processed /DEFAULTLIB:MSVCRT
1>Processed /DEFAULTLIB:OLDNAMES
1>Searching libraries
1> Searching C:Program FilesMicrosoft Visual Studio 8VCPlatformSDKlibufferoverflowU.lib:
1> Found @__security_check_cookie@4
1> Referenced in NistWrapper.obj
1> Loaded bufferoverflowU.lib(secchk.obj)
1> Found ___report_gsfailure
1> Referenced in bufferoverflowU.lib(secchk.obj)
1> Loaded bufferoverflowU.lib(gs_report.obj)
1> Found ___security_cookie
1> Referenced in bufferoverflowU.lib(secchk.obj)
1> Referenced in bufferoverflowU.lib(gs_report.obj)
1> Loaded bufferoverflowU.lib(gs_support.obj)
1> Searching C:Documents and SettingssepolakMy DocumentsVisual Studio 2005ProjectsRDNISTRDNISTReleaseRDNIST.lib:
1> Found _RDNIST
1> Referenced in NistWrapper.obj
1> Loaded RDNIST.lib(rdnist.obj)
1> Found _FDATA
1> Referenced in RDNIST.lib(rdnist.obj)
1> Loaded RDNIST.lib(nist_cof_quiet_lump.obj)
1> Found _RDPROPS
1> Referenced in RDNIST.lib(rdnist.obj)
1> Loaded RDNIST.lib(rdprops.obj)
1> Found _PUSHRDPROPS
1> Referenced in RDNIST.lib(rdprops.obj)
1> Loaded RDNIST.lib(pushpoprdprops.obj)
1> Searching C:Program FilesMathsoftMathcad 13userefimicrosftlibMCADUSER.LIB:
1> Found _CreateUserErrorMessageTable
1> Referenced in NistWrapper.obj
1> Loaded MCADUSER.LIB(userdll.def)
1> Found _MathcadArrayAllocate
1> Referenced in NistWrapper.obj
1> Loaded MCADUSER.LIB(userdll.def)
1>&nbs p; Found _CreateUserFunction
1> Referenced in NistWrapper.obj
1> Loaded MCADUSER.LIB(userdll.def)
1> Found _MathcadArrayFree
1> Referenced in NistWrapper.obj
1> Loaded MCADUSER.LIB(userdll.def)
1> Found _isUserInterrupted
1> Referenced in NistWrapper.obj
1> Loaded MCADUSER.LIB(userdll.def)
1> Found __imp__CreateUserErrorMessageTable
1> Referenced in MCADUSER.LIB(userdll.def)
1> Loaded MCADUSER.LIB(userdll.def)
1> Found __imp__MathcadArrayAllocate
1> Referenced in MCADUSER.LIB(userdll.def)
1> Loaded MCADUSER.LIB(userdll.def)
1> Found __imp__CreateUserFunction
1> Referenced in MCADUSER.LIB(userdll.def)
1> Loaded MCADUSER.LIB(userdll.def)
1> Found __imp__MathcadArrayFree
1> Referenced in MCADUSER.LIB(userdll.def)
1> Loaded MCADUSER.LIB(userdll.def)
1> Found __imp__isUserInterrupted
1> Referenced in MCADUSER.LIB(userdll.def)
1> Loaded MCADUSER.LIB(userdll.def)
1> Found mcaduser_IMPORT_DESCRIPTOR
1> Referenced in MCADUSER.LIB(userdll.def)
1> Referenced in MCADUSER.LIB(userdll.def)
1> Referenced in MCADUSER.LIB(userdll.def)
1> Referenced in MCADUSER.LIB(userdll.def)
1> Referenced in MCADUSER.LIB(userdll.def)
1> Loaded MCADUSER.LIB(userdll.def)
1> Found NULL_IMPORT_DESCRIPTOR
1> Referenced in MCADUSER.LIB(userdll.def)
1> Loaded MCADUSER.LIB(userdll.def)
1> Found mcaduser__imp__NULL
1> Referenced in MCADUSER.LIB(userdll.def)
1> Loaded MCADUSER.LIB(userdll.def)
1> Searching C:Program FilesMicrosoft Visual Studio 8VClibkernel32.lib:
1> Found __imp__TerminateProcess@8
1> Referenced in bufferoverflowU.lib(gs_report.obj)
1> Loaded kernel32.lib(KERNEL32.dll)
1> Found __imp__GetCurrentProcess@0
1> Referenced in bufferoverflowU. lib(gs_report.obj)
1> Loaded kernel32.lib(KERNEL32.dll)
1> Found __imp__UnhandledExceptionFilter@4
1> Referenced in bufferoverflowU.lib(gs_report.obj)
1> Loaded kernel32.lib(KERNEL32.dll)
1> Found __imp__SetUnhandledExceptionFilter@4
1> Referenced in bufferoverflowU.lib(gs_report.obj)
1> Loaded kernel32.lib(KERNEL32.dll)
1> Found __imp__QueryPerformanceCounter@4
1> Referenced in bufferoverflowU.lib(gs_support.obj)
1> Loaded kernel32.lib(KERNEL32.dll)
1> Found __imp__GetTickCount@0
1> Referenced in bufferoverflowU.lib(gs_support.obj)
1> Loaded kernel32.lib(KERNEL32.dll)
1> Found __imp__GetCurrentThreadId@0
1> Referenced in bufferoverflowU.lib(gs_support.obj)
1> Loaded kernel32.lib(KERNEL32.dll)
1> Found __imp__GetCurrentProcessId@0
1> Referenced in bufferoverflowU.lib(gs_support.obj)
1> Loaded kernel32.lib(KERNEL32.dll)
1> Found __imp__GetSystemTimeAsFileTime@4
1> Referenced in bufferoverflowU.lib(gs_support.obj)
1> Loaded kernel32.lib(KERNEL32.dll)
1> Found __IMPORT_DESCRIPTOR_KERNEL32
1> Referenced in kernel32.lib(KERNEL32.dll)
1> Referenced in kernel32.lib(KERNEL32.dll)
1> Referenced in kernel32.lib(KERNEL32.dll)
1> Referenced in kernel32.lib(KERNEL32.dll)
1> Referenced in kernel32.lib(KERNEL32.dll)
1> Referenced in kernel32.lib(KERNEL32.dll)
1> Referenced in kernel32.lib(KERNEL32.dll)
1> Referenced in kernel32.lib(KERNEL32.dll)
1> Referenced in kernel32.lib(KERNEL32.dll)
1> Loaded kernel32.lib(KERNEL32.dll)
1> Found __NULL_IMPORT_DESCRIPTOR
1> Referenced in kernel32.lib(KERNEL32.dll)
1> Loaded kernel32.lib(KERNEL32.dll)
1> Found KERNEL32_NULL_THUNK_DATA
1> Referenced in kernel32.lib(KERNEL32.dll)
1> Loaded kernel32.lib(KERNEL32.dll)
1> Searching C:Program FilesMicrosoft Visual Studio 8VC PlatformSDKlibuser32.lib:
1> Searching C:Program FilesMicrosoft Visual Studio 8VCPlatformSDKlibgdi32.lib:
1> Searching C:Program FilesMicrosoft Visual Studio 8VCPlatformSDKlibwinspool.lib:
1> Searching C:Program FilesMicrosoft Visual Studio 8VCPlatformSDKlibcomdlg32.lib:
1> Searching C:Program FilesMicrosoft Visual Studio 8VCPlatformSDKlibadvapi32.lib:
1> Searching C:Program FilesMicrosoft Visual Studio 8VCPlatformSDKlibshell32.lib:
1> Searching C:Program FilesMicrosoft Visual Studio 8VCPlatformSDKlibole32.lib:
1> Searching C:Program FilesMicrosoft Visual Studio 8VCPlatformSDKliboleaut32.lib:
1> Searching C:Program FilesMicrosoft Visual Studio 8VClibuuid.lib:
1> Searching C:Program FilesMicrosoft Visual Studio 8VCPlatformSDKlibodbc32.lib:
1> Searching C:Program FilesMicrosoft Visual Studio 8VCPlatformSDKlibodbccp32.lib:
1> Searching C:Program FilesMicrosoft Visual Studio 8VClibMSVCRT.lib:
1> Found __fltused
1> Referenced in RDNIST.lib(rdnist.obj)
1> Referenced in RDNIST.lib(nist_cof_quiet_lump.obj)
1> Referenced in RDNIST.lib(rdprops.obj)
1> Referenced in RDNIST.lib(pushpoprdprops.obj)
1> Loaded MSVCRT.lib(dllsupp.obj)
1> Found _pow
1> Referenced in RDNIST.lib(nist_cof_quiet_lump.obj)
1> Loaded MSVCRT.lib(MSVCR80.dll)
1> Found _memmove
1> Referenced in RDNIST.lib(nist_cof_quiet_lump.obj)
1> Loaded MSVCRT.lib(MSVCR80.dll)
1> Found _exp
1> Referenced in RDNIST.lib(nist_cof_quiet_lump.obj)
1> Loaded MSVCRT.lib(MSVCR80.dll)
1> Found _log
1> Referenced in RDNIST.lib(nist_cof_quiet_lump.obj)
1> Loaded MSVCRT.lib(MSVCR80.dll)
1> Found __IMPORT_DESCRIPTOR_MSVCR80
1> Referenced in MSVCRT.lib(MSVCR80.dll)
1> Referenced in MSVCRT.lib(MSVCR80.dll)
1> Referenced in MSVCRT.lib(MSVCR80.dll)
1> Referenced in MSVCRT.lib(MSVCR80.dll)
1> Loaded MSVCRT.lib(MSVCR80.dll)
1> Found MSVCR80_NULL_THUNK_DATA
1> Referenced in MSVCRT.lib(MSVCR80.dll)
1> Loaded MSVCRT.lib(MSVCR80.dll)
1> Searching C:Program FilesMicrosoft Visua l Studio 8VClibOLDNAMES.lib:
1> Searching C:Program FilesMicrosoft Visual Studio 8VCPlatformSDKlibufferoverflowU.lib:
1> Searching C:Documents and SettingssepolakMy DocumentsVisual Studio 2005ProjectsRDNISTRDNISTReleaseRDNIST.lib:
1> Searching C:Program FilesMathsoftMathcad 13userefimicrosftlibMCADUSER.LIB:
1> Searching C:Program FilesMicrosoft Visual Studio 8VClibkernel32.lib:
1> Searching C:Program FilesMicrosoft Visual Studio 8VCPlatformSDKlibuser32.lib:
1> Searching C:Program FilesMicrosoft Visual Studio 8VCPlatformSDKlibgdi32.lib:
1> Searching C:Program FilesMicrosoft Visual Studio 8VCPlatformSDKlibwinspool.lib:
1> Searching C:Program FilesMicrosoft Visual Studio 8VCPlatformSDKlibcomdlg32.lib:
1> Searching C:Program FilesMicrosoft Visual Studio 8VCPlatformSDKlibadvapi32.lib:
1> Searching C:Program FilesMicrosoft Visual Studio 8VCPlatformSDKlibshell32.lib:
1> Searching C:Program FilesMicrosoft Visual Studio 8VCPlatformSDKlibole32.lib:
1> Searching C:Program FilesMicrosoft Visual Studio 8VCPlatformSDKliboleaut32.lib:
1> Searching C:Program FilesMicrosoft Visual Studio 8VClibuuid.lib:
1> Searching C:Program FilesMicrosoft Visual Studio 8VCPlatformSDKlibodbc32.lib:
1> Searching C:Program FilesMicrosoft Visual Studio 8VCPlatformSDKlibodbccp32.lib:
1>Finished searching libraries
1>Finished pass 1
1>RDNIST.lib(rdnist.obj) : error LNK2001: unresolved external symbol _for_stop_core
1>RDNIST.lib(nist_cof_quiet_lump.obj) : error LNK2001: unresolved external symbol _for_stop_core
1>RDNIST.lib(rdprops.obj) : error LNK2001: unresolved external symbol _for_stop_core
1>RDNIST.lib(nist_cof_quiet_lump.obj) : error LNK2001: unresolved external symbol _for_read_seq_lis
1>RDNIST.lib(nist_cof_quiet_lump.obj) : error LNK2001: unresolved external symbol _for_close
1>RDNIST.lib(nist_cof_quiet_lump.obj) : error LNK2001: unresolved external symbol _for_rewind
1>RDNIST.lib(nist_cof_quiet_lump.obj) : error LNK2001: unresolved external symbol _for_read_seq_fmt
1>RDNIST.lib(nist_cof_quiet_lump.obj) : error LNK2001: unresolved external symbol _for_write_seq_fmt
1>RDNIST.lib(nist_cof_quiet_lump.obj) : error LNK2001: unresolved external symbol _for_open
1>RDNIST.lib(nist_cof_quiet_lump.obj) : error LNK2001: unresolved external symbol _for_f90_index
1>RDNIST.lib(nist_cof_quiet_lump.obj) : error LNK2001: unresolved external symbol _for_cpstr
1>RDNIST.lib(nist_cof_quiet_lump.obj) : error LNK2001: unresolved external symbol _for_cpystr
1>RDNIST.lib(nist_cof_quiet_lump.obj) : error LNK2001: unresolved external symbol _cbrt
1>RDNIST.lib(rdprops.obj) : error LNK2001: unresolved external symbol _for_write_seq_lis
1>RDNIST.lib(pushpoprdprops.obj) : error LNK2001: unresolved external symbol _for_write_seq_lis
1>RDNIST.lib(rdprops.obj) : error LNK2001: unresolved external symbol _for_write_seq_lis_xmit
1>RDNIST.lib(pushpoprdprops.obj) : error LNK2001: unresolved external symbol _for_write_seq_lis_xmit
1>C:Docu ments and SettingssepolakMy DocumentsVisual Studio 2005ProjectsNistWrapperReleaseNistWrapper.dll : fatal error LNK1120: 13 unresolved externals
1>Build log was saved at "file://c:Documents and SettingssepolakMy DocumentsVisual Studio 2005ProjectsNistWrapperNistWrapperReleaseBuildLog.htm"
1>NistWrapper - 18 error(s), 0 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

0 Kudos
Steven_L_Intel1
Employee
3,336 Views
Do a rebuild of the solution - same thing? From that output, the Fortran code is not specifying the Fortran library libifcore.lib. Open one of the Fortran-compiled .obj files in notepad. You should see something that looks vaguely like this (names may vary):

-defaultlib:ifconsol -defaultlib:libifcoremt -defaultlib:libifport -defaultlib:libmmt -defaultlib:LIBCMT -defaultlib:libirc -defaultlib:OLDNAMES -defaultlib:ifconsol -defaultlib:libifcoremt -defaultlib:libifport -defaultlib:libmmt -defaultlib:LIBCMT -defaultlib:libirc -defaultlib:OLDNAMES
0 Kudos
Jugoslav_Dujic
Valued Contributor II
3,336 Views
Or, in command prompt, navigate to the directory containing .obj or .lib files (Debug or Release) and type

dumpbin /directives whatever.obj
0 Kudos
polakse
Beginner
3,336 Views
Update:
At some point, I set the "Disable Default Library Search Rules" setting in the Fortran project to "Yes." After setting that back to "No," the nine C++ linking errors below went away. Now, I'm left with just this error:

RDNIST.lib(libifcoremain.obj) : error LNK2001: unresolved external symbol _MAIN__


Previous Post:
Ok, I tried opening the Fortran-compiled .obj files, but they aren't plain-text and I didn't see anything like that "-defaultlib:..." text in Steve's post. I even converted the file to HEX, but thta didn't help.

I also tried Jugoslav's suggestion, but using "dumpbin /directives foo.obj" (or "foo.lib") only gives me a summary of the file, and no information about library dependencies.

However, I did add the following default libs from Steve's post in the "Additional Dependencies" setting of the Fortran project:
ibifcoremt.lib libmmt.lib libirc.lib libifport.lib ifconsol.lib

After re-building the Fortran solution, I now get the following errors when trying to build/link the C++ solution:

Error 1 error LNK2001: unresolved external symbol __iob RDNIST.lib
Error 2 error LNK2001: unresolved external symbol __iob RDNIST.lib
Error 3 error LNK2001: unresolved external symbol __iob RDNIST.lib
Error 4 error LNK2001: unresolved external symbol ___mb_cur_max RDNIST.lib
Error 5 error LNK2001: unresolved external symbol ___mb_cur_max RDNIST.lib
Error 6 error LNK2001: unresolved external symbol __pctype RDNIST.lib
Error 7 error LNK2001: unresolved external symbol __pctype RDNIST.lib
Error 8 error LNK2001: unresolved external symbol ___argc RDNIST.lib
Error 9 error LNK2001: unresolved external symbol ___argv RDNIST.lib


0 Kudos
Steven_L_Intel1
Employee
3,336 Views
How did you get libifcoremain inserted into your library?
0 Kudos
anthonyrichards
New Contributor III
3,336 Views

Might I suggest the following?

In the C-code

extern "C" { void __cdecl RDNIST(double *bar); }
double bar = 3.14;
returnValues[0] = bar;
RDNIST(bar);
returnValues[1] = bar;

and in the Fortran code:

SUBROUTINE RDNIST(FOO)
!
!DEC$ ATTRIBUTES C, REFERENCE, ALIAS : '_RDNIST' :: RDNIST
!DEC$ ATTRIBUTES REFERENCE :: FOO
REAL*8 FOO

FOO = FOO * 2
RETURN
END SUBROUTINE RDNIST

0 Kudos
polakse
Beginner
3,336 Views
I'm not sure how/why libifcormain was inserted. I imagine it came along with one of the libs I added to the "Additional Dependencies" setting of the Fortran project?
ibifcoremt.lib libmmt.lib libirc.lib libifport.lib ifconsol.lib

Here is another piece of info that I just discovered... The Fortran code I have been working with (the real code, not the tests/examples I've posted) is apparently written in F66. Somebody else wrote this code a long time ago (like I said, I pretty clueless when it comes to Fortran). The file extensions of the Fortran source files I'm working with are *.f

The tests/examples I've created have been based on F90 code (*.f90 extension). These test/examples build and link into my C++ wrapper just fine, no errors. The F66 code, however, gives me unresolved external errors from the Fortran lib when I try to link the C++ project. Does that make sense? Is the Fortran compiler trying to include different libraries for the F66 code and the F90 code? Maybe that's inconsequential and far-fetched, but hopefully it helps shed some light on this problem of mine.

As usual, thanks for all your help!
0 Kudos
Steven_L_Intel1
Employee
3,336 Views
The various ATTRIBUTES you specify just reinforce the default. They should have no effect.
0 Kudos
polakse
Beginner
3,336 Views
Steve/Jugoslav, forgive my ignorance. I was using the wrong syntax for the dumpbin command. If I run "dumpbin -directives" on each of the four objects that are linked into my Fortran lib, here are the directives (same for each object):

Linker Directives
-----------------
-defaultlib:ifconsol
-defaultlib:libifcoremt
-defaultlib:libifport
-defaultlib:libmmt
-defaultlib:LIBCMT
-defaultlib:libirc
-defaultlib:OLDNAMES
-defaultlib:ifconsol
-defaultlib:libifcoremt
-defaultlib:libifport
-defaultlib:libmmt
-defaultlib:LIBCMT
-defaultlib:libirc
-defaultlib:OLDNAMES


This Fortran lib I'm building is wrapped in a C++ dll.... The C++ dll provides all the user interface through OLE. With this in mind, do I even need any of the libs above? Are those all related to making the Fortran code into an application? Is there a way to exclude them from my Fortran project without having to modify this legacy Fortran code I'm trying to use?

Thanks!
Scott
0 Kudos
Steven_L_Intel1
Employee
3,123 Views
You should remove all these libraries from the "additional dependencies" list - the directives cause the necessary libraries to be referenced and some of them are required. (Those that aren't won't in fact be used.)

Make sure that there's no Fortran main program in your Fortran code you're building into the DLL.
0 Kudos
Reply