Dll entry point aliasing
John Barnes
johnbarnes2858@gmail.com
Sun Jun 22 14:49:00 GMT 2014
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.
More information about the Fortran
mailing list