I am trying to create a Fortran DLL containing a Common Block which I can then use to link with a C program to resolve an external name.
The DLL appears to create successfully but when I link the C program I always get an unresolved external symbol. This code does work when the Fortran part is not built as a DLL. Does anybody have any ideas ?
I have shown my code below.
Fortran DLL:
!DEC$ DEFINE GLOBAL_EXPORT
block data
include 'GLOBAL01.FI'
data PRBUZ /0.0/
end
GLOBAL01.FI include file:
REAL*8 prbuz
COMMON /GLOBAL01/ prbuz
!DEC$ IF DEFINED (GLOBAL_EXPORT)
!DEC$ ATTRIBUTES DLLEXPORT :: /GLOBAL01/
!DEC$ ELSE
!DEC$ ATTRIBUTES DLLIMPORT :: /GLOBAL01/
volatile /GLOBAL01/
!DEC$ ENDIF
C program:
#include
struct g1 struct
{
double prbuz;
};
extern struct g1 global01;
main()
{
global01.prbuz = 50.0;
}
When this is linked against the above DLL I always get GLOBAL01 reported as undefined.