- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am porting my CVF code to IVF and Visual Studio 2010. I have a subroutine that uses a DLL library. The documentation says that the method of import is the same for IVF as it was for CVF, but it does not work. It compiles but does not link.
I am importing with
!DEC$ ATTRIBUTES DLLIMPORT :: KECHK32
and then calling with
CALL KECHK32(AZBLOCK)
I get the following error:
Error 1 error LNK2019: unresolved external symbol __imp__KECHK32 referenced in function _PROTECTAZ protect.obj
I am linking with the same KECHK32.LIB that I used with CVF. I am wondering if there is a change in naming convention? Or am I doing something else wrong? Or do I need a new version of the LIB and corresponding CLL files from the hardware manufacturer (www.az-tech.com)?
Thanks for any help,
Charles
I am importing with
!DEC$ ATTRIBUTES DLLIMPORT :: KECHK32
and then calling with
CALL KECHK32(AZBLOCK)
I get the following error:
Error 1 error LNK2019: unresolved external symbol __imp__KECHK32 referenced in function _PROTECTAZ protect.obj
I am linking with the same KECHK32.LIB that I used with CVF. I am wondering if there is a change in naming convention? Or am I doing something else wrong? Or do I need a new version of the LIB and corresponding CLL files from the hardware manufacturer (www.az-tech.com)?
Thanks for any help,
Charles
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The default calling conventions of IVF and CVF are different.
If you cannot conveniently obtain IVF versions of DLLs and import libraries from the third party, you need to read through the chapter on mixed language programming in the IFort User Guide. IVF comes with some examples of mixed language programs, as well.
You may use the /iface:cvf compiler option, modify the directives in your source code, or consider using the C-interoperability features of Fortran 2003.
If you cannot conveniently obtain IVF versions of DLLs and import libraries from the third party, you need to read through the chapter on mixed language programming in the IFort User Guide. IVF comes with some examples of mixed language programs, as well.
You may use the /iface:cvf compiler option, modify the directives in your source code, or consider using the C-interoperability features of Fortran 2003.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
First you need to know what calling convention is used by the subroutine in the DLL.
Then you neeed to include an INTERFACE definition for the subroutine, wherever it occurs in your Fortran code.
This INTERFACE will include, among other things, the calling convention to be used and, if necessary, an ALIAS attribute enabling the correct symbol to be generated by the compiler to match that EXPORTed by the DLL containing the subroutine you want to call.
It might be worth using the DUMPBIN utility on the DLL binary file to see exactly what symbols are exported from it and to get the exact symbol for your KETCHK32 subroutine.
Then you neeed to include an INTERFACE definition for the subroutine, wherever it occurs in your Fortran code.
This INTERFACE will include, among other things, the calling convention to be used and, if necessary, an ALIAS attribute enabling the correct symbol to be generated by the compiler to match that EXPORTed by the DLL containing the subroutine you want to call.
It might be worth using the DUMPBIN utility on the DLL binary file to see exactly what symbols are exported from it and to get the exact symbol for your KETCHK32 subroutine.

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