LF Fortran 95  

Referencing DLL Procedures

Fortran functions are called from C as functions returning a value.

For example, this Fortran function:

function dll1(a, a1, i, i1, l, l1)
   integer, dll_export :: DLL1
   real a, a1(10)
   integer i, i1(10)
   logical l, l1(10)
end function

uses this C prototype:

long foo(long int *i, long int *j);

To reference the above function from your C code, declare it with _stdcall:

long _stdcall foo(long int *i, long int *j);

In C++, use:

extern "C" {long _stdcall foo(long int *i, long int *j); };