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

Linking IMSL libraries using C or STDCALL calling conventions?

nuke
Beginner
337 Views
Under Project | Properties dialog box in Fortran | External Procedures
when I set the Calling Convention to "Default" everything compiles fine, but LoadLibrary(...) fails from my C code. When I use "STDCALL, REFERENCE" or "C, REFERENCE", then the linker cannot find the IMSL libraries (because the linker appears to be translating the names).
In the exported function, I use

!DEC$ ATTRIBUTES C, DLLEXPORT::Clust

(and I've tried with STDCALL, too) and in the function that uses the IMSL libraries (MDA), I have tried both the static and DLL header files
INCLUDE 'link_f90_static.h'
or
INCLUDE 'link_f90_dll.h'
and it gives me the following error while linking.
CLUS2.obj : error LNK2019: unresolved external symbol _LINDS@20 referenced in function _MDA


Any ideas?
0 Kudos
1 Reply
Steven_L_Intel1
Employee
337 Views
I am confused as to what you are trying to do.

First, the IMSL routines use the compiler's default calling convention - for ifort, that's C, by reference (but not the same as your saying C, REFERENCE, as that lowercases the names! Nevertheless, if you use the IMSL modules in 9.0, you'll always get the right convention, and I would recommend this.

Your specifying an ATTRIBUTES directive for Clust affects only that name - it doesn't affect routines called from within Clust.

As for LoadLibrary, that itself doesn't do anything with routine names, just DLL file names. It's GetProcAddress that cares about the name, and then you will want to have declared the procedure pointer with __stdcall if that's what you'll be using.
0 Kudos
Reply