creating dll to link with delphi program

Brad Finney brad.finney@humboldt.edu
Sat Oct 22 19:13:00 GMT 2011


I am using gfortran 4.7.0 20111011 under mingw32  I am not having any 
luck figuring out how to create a dll that has the required symbol 
naming convention to link with an existing delphi program.  The symbol 
names are suppose to be case sensitive and have no leading or trailing 
underscore.

for the following code (testcase.f90)

SUBROUTINE PrintOutX(x)
!GCC$ ATTRIBUTES DLLEXPORT::PrintOutX
  write(*,*)x
END SUBROUTINE PrintOutX

if I use

gfortran -c -fno-leading-underscore -fno-underscoring testcase.f90

The object file contains -export:"printoutx" which does not preserve the 
case of the requested export name.

When I actually create the dll using

gfortran -shared -fno-leading-underscore -fno-underscoring -o 
testcasel.dll testcase.o


I get undefined references to gfortran library routine such as 
'_gfortran_st_write'

If I instead compile with

gfortran -c -fno-underscoring testcase.f90

I can avoid the undefined references to gfortran library routines, but 
the exported symbol name is '_printoutx' not 'PrintOutX'

I know most of you are not windows programmers, but I am hoping somebody 
has faced this before and has some suggestions.

Thanks



More information about the Fortran mailing list