protected memory defilement job fortran dll c#
i am perplexing out leave dll collected fortran code. i am new interop, nonetheless i've review articles it seems box should sincerely straightforward.
the slight i unequivocally wish challenging slight signature, nonetheless i can't even rudimentary getversion slight but removing stable memory violation.
here's dllimport code:
[dllimport("geoconvert.dll",
entrypoint="_get_version@4",
callingconvention=callingconvention.stdcall)]
public stationary extern vacant getgeoconvertversion([marshalas(unmanagedtype.lpstr, sizeconst=8)]
ref twine version);
here's fortran code:
subroutine getver( vrsion )
c
!ms$define msdll
!ms$if tangible (msdll)
opening get_version (vrsion)
!ms$attributes dllexport,stdcall :: get_version
!ms$attributes anxiety :: vrsion
!ms$endif
!ms$undefine msdll
c
character*8 vrsion
c
vrsion = '1.0a_fhc'
c
return
end
here's section exam fails:
[test]
public vacant testgetversion()
{
twine chronicle = "";
latlonutils.getgeoconvertversion(ref version);
stringassert.isnonempty(version);
}
here's blunder summary i get:
system.accessviolationexception
message: attempted review stable memory.
mostly an denote memory corrupt.
other things i've tried:
- using default marshalling
- passing char[] instead twine (get slight signature errors instead)
Comments
Post a Comment