Re: Dll with G95



e p chandler ha scritto:
Walter wrote:

Dear all,

I've compiled a F95 "test" program with G95, according to the
documentation in the G95 web site www.g95.org.

The dll has been created without problem, but I cant link it with VB5.
I received the following error message from VB: "can't get the enter point".

In my experience it should be due to the subroutine name that changes in
the dll from e.g. "name" to something like: "_name@number" (where
"number" is a 2 digit real number).

Supposing that this is the problem, actually, I don't know how to find
out the number associated with the soubroutine. Or there is something more?

Thanks in advance for your help,

Walter


number is the number of bytes of arguments passed on the stack. This is
different from the "ordinal" of the entry point - which you do not need
to specify. g95 mangles names to name_ without the @number. While there
are a number of ways to control how g95 (actually the gcc back end)
mangles names, I prefer to put the unmangling in a .def file.

Here is a representative command line:

g95 -s -shared -mrtd -o test.dll test.def test.f95

Where test.def contains:

EXPORTS name=name_

Note that -mrtd specifies the stdcall calling convention. I know that
this applies to routines that test.f95 might expose in the dll, but I
am not sure about what happens if the called routine itself calls other
routines or if the called routine makes calls to the run time library.

If this is not clear enough, a Google search should find a numer of
posts on this subject, some of which I have written, explaining in more
depth.

-- elliot


Dear Ellit,

your suggestions have been really good. Now the dll works perfectly.
Thank you very much vor your support.

Walter
.