Dll entry point aliasing

Tobias Burnus burnus@net-b.de
Sun Jun 22 20:10:00 GMT 2014


John Barnes wrote:
> subroutine XXXX_ENGINE_INITIALISE(args, success_code)
>      !DEC$ ATTRIBUTES DLLEXPORT :: XXXX_ENGINE_INITIALISE
>      !DEC$ ATTRIBUTES ALIAS:'_XXXX_ENGINE_INITIALISE' ::
> XXXX_ENGINE_INITIALISE
>      character(*), intent(in) :: args
>      integer, intent(out) :: success_code ! 0: ok, -ive fatal error, +ive warning

As Jenne has mentioned, we use Fortran 2003's C binding support for name 
of the function – which is additionally dressed according to the 
platform ABI; only the dllexport is beyond Fortran 2003 and uses a GCC 
directive.

For your program, it would be (with cdecl):

subroutine XXXX_ENGINE_INITIALISE(args, success_code) &
       BIND(C, name="_XXXX_ENGINE_INITIALISE")
!GCC$ attributes dllexport :: XXXX_ENGINE_INITIALISE

The string arument would have to be modified to
   character(len=1), dimension(*)
and possibly you need to add a trailing hidden string-length argument I 
don't know how you currently handle it.

Cf. https://gcc.gnu.org/onlinedocs/gfortran/Mixed-Language-Programming.html

Tobias



More information about the Fortran mailing list