- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In each of the Fortran library projects, change the property Fortran > Libraries > Disable default library search rules to "No" and rebuild.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve,
This option is already set to "No" by default.
Jon
This option is already set to "No" by default.
Jon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, Steve! /Zl switch worked.
Jon
Jon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please report this to Intel Premier Support and reference T80872-CP. This will help get it fixed faster.
![](/skins/images/895D6060305DF45A57FACF854B5A8CD1/responsive_peak/images/icon_anonymous_message.png)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page