Creating A .dll With Gfortran
John Robinson
john.rbnsn@gmail.com
Mon Jun 15 13:40:00 GMT 2009
Hello,
I am trying to figure out how to compile a .dll that can be read by
MSVB. I have written my .def file, which references my Main.for file,
which contains the subroutine GGGmain, which is the one that I wish to
be accessible through the .dll file. My .def file looks like:
EXPORTS
gggmain
Then I attempt to compile the file with a makefile that looks like:
objects = Main.o In.o Io.o Ngg1.o Ngg2.o Ngg3.o\
Notice.o
GGGE: GGE.o
gfortran -mdll -o junk.tmp -Wl,--base-file,base.tmp main.o
del junk.tmp
dlltool --dllname GGGE.dll --base-file base.tmp --output-exp
temp.exp --def gggdll.def
del base.tmp
gfortran -shared -mrtd -mdll -o GGGE.dll Main.o -Wl,temp.exp
del temp.exp
GGE.o: $(objects)
gfortran -o GGE.o $(objects)
Main.o : Main.for
gfortran -c Main.for
In.o : In.for
gfortran -c In.for
Io.o : Io.for
gfortran -c Io.for
Ngg1.o : Ngg1.for
gfortran -c Ngg1.for
Ngg2.o : Ngg2.for
gfortran -c Ngg2.for
Ngg3.o : Ngg3.for
gfortran -c Ngg3.for
Notice.o : Notice.for
gfortran -c Notice.for
clean :
del MMME $(objects)
When I attempt to run the makefile I get the error:
undefined reference to '_notice_'
undefined reference to '_notice_'
undefined reference to '_input_'
undefined reference to '_initial_'
etc.
All of the names in the '_program_' line are subprograms from my other
object files other than Main.for.
I also tried using GGE.o in place of main.o in the dll compiling
section, but to no avail. This gave me errors telling me that I had
multiple definitions of '_atexit', '_onexit' etc.
Is there any documentation that you could refer me to, or a direct
answer that you could help me with?
Kind Regards,
John M. Robinson
716.907.4533
jr226@buffalo.edu
More information about the Fortran
mailing list