Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28632 Discussions

Unresolved external symbol _ISO_C_BINDING_mp_C_LOC in DLL version of an app

Jon_D
New Contributor I
491 Views
I have 3 static libraries:

1. LibA.lib : contains procedures written in C
2. LibB.lib : Fortran library that includes many functions and wrappers for C functions in LibA.lib using the ISO_C_BINDING intrinsic module
3. LibC.lib : Fortran library that uses LibB.lib

I compiled each of these libraries using multi-threaded (for static linking) and multi-threaded DLL (for dynamic linking) run-time libraries, all with debug and release versions. As far as I can tell, I included the correct version (i.e. version that uses debug multi-threaded, multi-threaded, debug multi-threaded DLL or multi-threaded DLL run-time libraries) of LibA.lib as a dependency in LibB.lib, and the correct version of LibB.lib as a dependency in LibC.lib. Upto this point, eveything went smoothly.

Then, I created a console application that uses LibC.lib that is built using the static run-time libraries (multi-threaded for release mode and debug multi-threaded for debug mode); no problems.

Finally, I tried to create a DLL that uses LibC.lib that is built using the dynamic run-time libraries (multi-threaded DLL for release mode and debug multi-threaded DLL for debug mode). At this stage I got the linker error "error LNK2019: unresolved external symbol _ISO_C_BINDING_mp_C_LOC referenced in function _WRITEMEM LibC_debug_dll.lib" for the debug version of my DLL. The release version also produces a similar error. I made use of ISO_C_BINDING intrinsic module in LibB.lib. I use several entities from ISO_C_BINDING (such as C_INT, C_LONG, C_PTR, etc) but it appears that only C_LOC gives me the linker error.

I am using IVF 10.0.027 with VS2005.

So, what am I missing here? Why can I build my console application with no problems but the DLL application produces an error specifically for C_LOC?

Thanks for any help in advance,
Jon

0 Kudos
5 Replies
Steven_L_Intel1
Employee
491 Views
In each of the Fortran library projects, change the property Fortran > Libraries > Disable default library search rules to "No" and rebuild.
0 Kudos
Jon_D
New Contributor I
491 Views
Steve,

This option is already set to "No" by default.

Jon
0 Kudos
Steven_L_Intel1
Employee
491 Views
It defaults to "Yes" for static library projects.

However, I see that if you build against DLL libraries, then the symbol is not defined. Oops! I'll report this to the developers.

A workaround. Compile the source to ISO_C_BINDING (you'll find it in the INCLUDE folder) with the /Zl switch (to disable library directives) and link the object in with your application.
0 Kudos
Jon_D
New Contributor I
491 Views
Thanks, Steve! /Zl switch worked.

Jon
0 Kudos
Steven_L_Intel1
Employee
491 Views
Please report this to Intel Premier Support and reference T80872-CP. This will help get it fixed faster.
0 Kudos
Reply