creating dll to link with delphi program
Steve Kargl
sgk@troutmask.apl.washington.edu
Sun Oct 23 19:34:00 GMT 2011
On Sun, Oct 23, 2011 at 11:57:32AM -0700, Brad Finney wrote:
> >
> >foo and bar are identical except for explicitly namng foo
> >as Foo in the bind() expression. Note case is preserved and
> >there is no trailing underscore.
> >
>
> Yes, I did try his suggestion, but missed the addition of the bind(c,
> name= " "). Thanks for getting me to read more carefully! That does
> correct the case issue, but not (for me) the underscore issue, which is
> very puzzling. I took the exact code you listed and got a leading
> underscore on Foo and bar.
I don't do Windows, so my code did not include
!GCC$ ATTRIBUTES DLLEXPORT::Foo
> F:\FlowReader>gfortran -shared -o foo.dll foo.o
> Cannot export Foo: symbol not found
> Cannot export bar_: symbol not found
> collect2.exe: error: ld returned 1 exit status
>
> F:\FlowReader>gfortran -shared -fno-leading-underscore -o foo.dll foo.o
> Cannot export Foo: symbol not found
> Cannot export bar_: symbol not found
> collect2.exe: error: ld returned 1 exit status
These are loader errors. I'm not familiar with how the loader
on Windows works. As Tobias noted, you might need to add the
stdcall attribute, but I thought that only dealt with who was
responsible for cleaning up the call stack.
--
Steve
More information about the Fortran
mailing list