- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to link against a LIB file containing a Fortran subroutine.
A dumpbin /all on the lib shows the Fortran routine as: _ledapm_run2phase
My call in my F90 file is to: call LedaPM_Run2phase(...
which creates an object file containing: _LEDAPM_RUN2PHASE
So I get: error LNK2019: unresolved external symbol _LEDAPM_RUN2PHASE referenced in function _LEDA2P
which is to be expected as in the lib it is all lower case. How can I get the link working? Why does the OBJ file capitalize the name?
Using: Intel(R) Composer XE 2013 SP1 Update 2 (package 176)
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Were the routines in the library compiled using a different compiler? If so, the case of external names is not the only incompatibility that you may have to contend with.
You can control the case of external names through the /names:<keyword> option, where <keyword> is as_is, lowercase, or uppercase. If that does not prove sufficient, you can use the C-interoperability feature of Fortran 200X:
... BIND(C, name='C_Library_Function’)
or use the older way based on compiler directives (not recommended anymore).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The lib is third party, all I am provided with is the LIB and DLL and documentation which shows how to make the call. There are Fortran and C interfaces (the same name).
I tried adding /names:uppercase to my Fortran project, but I got the same link error.
I also tried adding BIND(C, NAME="LEDAPM_RUN2PHASE") at the end of my interface / subroutine statement. But that didn't help either.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry the BIND now works if I put :
BIND(C, NAME="LedaPM_Run2phase")

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page