Hi everyone) dmd 2.058 os: win 7 64 bit fortran compilers: gfortran, ftn95
I have a fortran code that compiled into dll: SUBROUTINE fsu (i) real :: x integer :: i x = 0.025 print *, 'The answer is x = ', x , i END SUBROUTINE fsu and simple D code import std.stdio; import core.runtime; import std.c.windows.windows; import core.memory; alias void function(int) MyHandler; void main() { GC.disable; FARPROC fp; HMODULE lib = cast(HMODULE)Runtime.loadLibrary("testf.dll"); MyHandler mh; if (lib is null) { writeln("Lib!"); return; } fp = GetProcAddress(lib, "FSU"); if (fp is null) { writeln("Proc!"); writeln(GetLastError()); return; } mh = cast(MyHandler) fp; (*mh)(1); Runtime.unloadLibrary(lib); } and its output The answer is x = 2.500000E-02 1407551829 It's should be an 1 value instead 1407551829. I think, trouble in param passing. How it can be fixed? Or where to look? Thanks)