This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Dll entry point aliasing
- From: John Barnes <johnbarnes2858 at gmail dot com>
- To: fortran at gcc dot gnu dot org
- Date: Sun, 22 Jun 2014 15:49:34 +0100
- Subject: Dll entry point aliasing
- Authentication-results: sourceware.org; auth=none
I have a FORTRAN dll that I have compiled and used in a couple of
FORTRAN dialects. Seems that gFORTRAN (used in the MinGW32 environment
on Windows 7) sees the entry points a little differently.
This is how one of the entry points is defined in the FORTRAN code:
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
The above is used with C# calling code like:
[DllImport(ExternalDll_C.Filename,
EntryPoint = "XXXX_ENGINE_INITIALISE",
ExactSpelling = false,
CallingConvention = CallingConvention.Cdecl)
]
internal static extern void XXXX_ENGINE_INITIALISE(
[MarshalAs(UnmanagedType.LPStr)] StringBuilder inString,
ref int successCode, // 0: ok, -ive fatal error, +ive warning
int inStringLength);
Compile the above with other dialects of FORTRAN I have available and
Dependency Walker shows the dll has the expected entry point
XXXX_ENGINE_INITIALISE.
Compile using gFORTRAN and the entry point comes out as:
xxxx_engine_initialise_
I suspect that gFORTRAN does not recognise the DEC$ comment directives
and just applies its own name mangling. Is there a way I can change
that? Ideally with some other comment directive?
Thanks.