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

Calling a Fortran function, who has a c-header as the interface

Schwandt__Olaf
Beginner
240 Views

Hi Steve, hi all,

 

How can I call from Fortran a Fortran function, who has a C header as the interface (in a DLL)?

 

code within the dll:

 

C header:

extern "C" __declspec(dllimport) char*  _cdecl TRNSYSFUNCTIONS_mp_GETTRNSYSUSERLIBDIR(void);

#define getTrnsysUserLibDir                           TRNSYSFUNCTIONS_mp_GETTRNSYSUSERLIBDIR   

 

Fortranfunction:

! function getTrnsysUserLibDir: returns the location of the directory that contains Release versions of external DLLs.

Function getTrnsysUserLibDir()

 !dec$ attributes dllexport :: getTrnsysUserLibDir

 Use TrnsysData

 Character (len=maxPathLength) :: getTrnsysUserLibDir

 getTrnsysUserLibDir = TrnsysUserLibDir

End Function getTrnsysUserLibDir

 

In the dependency walker I can see this:

Ordinal: 170 (0x00A9), Hint: 169 (0x00AD), Function: TRNSYSFUNCTIONS_mp_GETTRNSYSUSERLIBDIR, Entry Point: 0x00A6CBA

 

Olaf

0 Kudos
0 Replies
Reply