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

Using both dynamic and static library by fortran

Majid_S_
Beginner
846 Views

I have a code which is using static libraries and now I wanna to add a dynamic dll library to that. When I import the new dll library I receive the following error:

libifcoremt.lib(for_init.obj) : error LNK2005: _for_set_fpe_ already defined in libifcoremd.lib(libifcoremd.dll)
libifcoremt.lib(for_vm.obj) : error LNK2005: _for_allocate already defined in libifcoremd.lib(libifcoremd.dll)
libifcoremt.lib(for_vm.obj) : error LNK2005: _for_alloc_allocatable already defined in libifcoremd.lib(libifcoremd.dll)
libifcoremt.lib(for_vm.obj) : error LNK2005: _for_dealloc_allocatable already defined in libifcoremd.lib(libifcoremd.dll)
libifcoremt.lib(for_vm.obj) : error LNK2005: _for_check_mult_overflow already defined in libifcoremd.lib(libifcoremd.dll)
libifcoremt.lib(for_diags_intel.obj) : error LNK2005: _for_emit_diagnostic already defined in libifcoremd.lib(libifcoremd.dll)
libifcoremt.lib(for_reentrancy.obj) : error LNK2005: _for_set_reentrancy already defined in libifcoremd.lib(libifcoremd.dll)
libifcoremt.lib(for_close.obj) : error LNK2005: _for_close already defined in libifcoremd.lib(libifcoremd.dll)
libifcoremt.lib(for_open.obj) : error LNK2005: _for_open already defined in libifcoremd.lib(libifcoremd.dll)
libifcoremt.lib(for_wseq.obj) : error LNK2005: _for_write_seq already defined in libifcoremd.lib(libifcoremd.dll)
libifcoremt.lib(for_wseq.obj) : error LNK2005: _for_write_seq_xmit already defined in libifcoremd.lib(libifcoremd.dll)
newnames.obj : error LNK2019: unresolved external symbol __imp__DLL_SETSEED@0 referenced in function _MAIN__

for runtime library option I have checked all the options (multithreaded dll, multithreaded, debug multithreaded, debug multithreaded dll, ...), however the problem has not been solved.

Can anybody help me?

0 Kudos
1 Reply
Steven_L_Intel1
Employee
846 Views

In the static library, change the property "Fortran > Libraries > Disable default library search rules" to Yes and rebuild it.

It looks as if you are also using the STDCALL or CVF calling convention - do you need that? I suggest changing the calling convention to Default in all your projects.

0 Kudos
Reply