Small stripped-down program:
program test
! C_EXTERNAL WINDOW_UPDATE@
integer i
real*8 rb_double
character(len=5) rb_string
rb_double = 1.0d0
rb_string = 'test1'
i=winio@('%5rs&', rb_string)
i=winio@('%5rf&', rb_double)
rb_double = 2.0d0
rb_string = 'test2'
CALL window_update@(rb_string)
CALL window_update@(rb_double)
i=winio@('')
end program
Compiled with 'ftn95 /checkmate /clr test.f95 /link' whereas the checkmate can be replaced with optimise, and the /clr_ver 2 be added without changing the error. Using the full /REF's of the assemblies results in the same crash when starting the compiled executable.
With the 'C_EXTERNAL WINDOW_UPDATE@' at the program start the application works fine, as the non-clr version does. Note that the IL disassembly contains 'WINDOW_UPDATE# : void(valuetype [ftn95lib]Salford.Fortran.Character*,int32)' whereas the IL disasm of the C_EXTERNAL version reads 'WINDOW_UPDATE# : void(valuetype [ftn95lib]Salford.Fortran.Character*)' (supposedly pointer-only usage, therefore omitted checking, or zero-terminated string).
Thanks for your help!