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
.



Relevant Pages

  • Re: Dll with G95
    ... I've compiled a F95 "test" program with G95, ... The dll has been created without problem, but I cant link it with VB5. ... g95 mangles names to name_ without the @number. ... routines or if the called routine makes calls to the run time library. ...
    (comp.lang.fortran)
  • Re: Dll with G95
    ... I've compiled a F95 "test" program with G95, ... The dll has been created without problem, but I cant link it with VB5. ... g95 mangles names to name_ without the @number. ... routines or if the called routine makes calls to the run time library. ...
    (comp.lang.fortran)
  • Re: gFortran wont recognize def file
    ... That previous example I posted exports only dgesvx, ... I took what you sent and created a bat file to run the compiler/linker ... linked with g95 using a command line bat file. ... the linking successfuly completed and the dll was created. ...
    (comp.lang.fortran)
  • Re: g95 executables on Windows require cygwin1.dll on PATH
    ... Is there a way to add a compiler option so that the ... DLL at runtime, and you can download the DLL somewhere, ... required to run a g95 executable are available somewhere on ... can be discussed, like gfortran seems to have, or do you think ...
    (comp.lang.fortran)
  • Re: Need help to build a DLL with G95
    ... > I would like to build a DLL with G95 in view to use it with VBA. ... You cannot use g95 on Windows to create a DLL to use with VBA, ... generates DLLs and EXEs that depend on the Cygwin run-time DLL. ...
    (comp.lang.fortran)