- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
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.
![](/skins/images/3CECF0550DB8BF54496C114A1FF06FE9/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