- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am creating a DLL that has some functions that are in a separate static library (.LIB file).
In Linux and Mac, I can create the .so (shared object) without linking to the static library. Linux is straightforward. In Mac, I do the following:
libtool -dynamic -undefined suppress -flat_namespace -macosx_version_min 10.7 -o PluginSystem/Plugins/VerificationPlugin.fortran.so PluginSystem/Plugins/VerificationPlugin.fortran.o
This gives me a .so file without the need of the static library.
How can I do this in Windows. Is there a setting that can let me not link to the external procedures that are present in the static library? Please help!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Windows doesn't allow you defer linking to a static library for references in a DLL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Steve for the information that Windows doesn't allow to defer linking to a static library for references in a DLL.
Here is my problem now.
I have a static library called aStatic.lib that was created with Runtime library: Debug Multithreaded
I have a bDynamic.dll that was linked with aStatic.lib with Runtime library: Debug Multithreaded
I now want my test program to link with both aStatic.lib and bDynamic.dll. My test program is with Runtime library: Debug Multithreaded
The bDynamic.dll. is dynamically loaded and consumed with functions like LoadLibrary and GetProcAddress.
Everything looks fine except that I hit a HEAD error: "Debug Assertion Failed" - dbgheap.c Line 1424, Expression _pFirstBlock==pHead
The above setup work perfectly fine in Linux and Mac with .so files (instead of dll as in Windows).
I don't know what setting in IFORT Visual Studio to change now. Please help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to change the runtime library in both the static library and DLL projects to "Multithreaded DLL" (Debug for the Debug configuration if you wish, non-debug for the Release configuration.) The way you have it, you have two copies of the run-time libraries that don't talk to each other, leading to errors such as this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Steve. So I should have Multithreaded DLL set as Runtime library for all the THREE projects. Right? i.e. Static Library project, DLL project, and the test project.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK, I am getting this error:
LIBCMT.lib(ieee87.obj) : error LNK2005: __clearfp already defined in MSVCRT.lib(MSVCR110.dll)
When I place MSVCRT.lib in the Ignore Library list, this error goes away. However, it seems that the "multiple copies of the run-time libraries that don't talk to each other" is still there. Any ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to recompile all the sources and make sure that the setting for the runtime library is the same in each. ieee87.obj is still referencing the static libraries.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page