I write an UI with Visual Studio 2010 Express and Fortran subroutines with Plato 3 I want to call one of these routine from my .NET application Inside this application I define :
Public Class Unmnaged Declare Auto Sub RESOLVE Lib 'D:\RESOLUTION.dll' (<In, Out()> ByRef kont As Integer, <In, Out()> ByRef mat As Integer) End Class
Dim kont, mat(80) As Integer
and I call the routine by the following way :
Call Unmnaged.RESOLVE(kont, mat(0))
To create the RESOLUTION.Dll file I compile and link whith :
FTN95 'D:\RESOLUTION.f95' slink RESOLUTION.opt RESOLUTION.dll
'D:\RESOLUTION.f95' is my source code written with Plato . Its begining is : subroutine RESOLVE (kont,mat1)
INTEGER,INTENT(INOUT):: kont INTEGER,INTENT(INOUT):: mat1( : )
The file RESOLUTION.opt contains : dll load RESOLUTION exportall archive RESOLUTION.lib file RESOLUTION.dll
When I run the application from whithin Visual Studio 2010 Express I get the message : (originaly the message is in French ! That's my translation !)
Message: runtime met an irremediable error. The address of the error was 0x6df57e06 on the thread 0xa1c. The code of error is 0xc0000005. It is maybe about a bug in the CLR or in the portions unsafe or not verifiable of the user code. The common causes of this bug include errors of marshaling user for COM-Interop or PInvoke, errors susceptible to damage the stack.
Have somebody an idea about that ?
Thanks