intptr
-
i made a delegate of one sub and sent its method.methodhandle.value to a sub in a VisualFortran Dll. the sub in VisualFortran creates an interface to work with this sub and calling it from fortran. this works in vb6 when i send the (addressof sub) to visual fortran but it does not work when the delegate.method.methodhandle.value in vb.net is sent to the fortran dll. i know intptr is not even a CLS-Comapliant but i recieve the error "protected memory ..."
A.E.K
-
i made a delegate of one sub and sent its method.methodhandle.value to a sub in a VisualFortran Dll. the sub in VisualFortran creates an interface to work with this sub and calling it from fortran. this works in vb6 when i send the (addressof sub) to visual fortran but it does not work when the delegate.method.methodhandle.value in vb.net is sent to the fortran dll. i know intptr is not even a CLS-Comapliant but i recieve the error "protected memory ..."
A.E.K
Without seeing your code that declares the delegate, the function your calling, and the callback function in your code, it's kind of hard to diagnose. This[^] is about the only thing anyone can recommend.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
Without seeing your code that declares the delegate, the function your calling, and the callback function in your code, it's kind of hard to diagnose. This[^] is about the only thing anyone can recommend.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007This is the code in VB.NET
Private Declare Function dll1 Lib "FileAddress" (ByVal ptr As Integer) as Single Public Delegate Function del1(ByVal p As Single) As Single Dim g1 As del1 = AddressOf proc1 Function proc1(ByVal p As Single) As Single Return p ^ 2 End Function
Here is the function Call(in.Net):dll1(g1.Method.MethodHandle.Value)
and here the code in VisualFortran:Real function dll1(F) !dec$ attributes dllexport ::dll1 !dec$ attributes alias :'dll1'::dll1 interface real function F(x) real x end end interface end
and I recieve this Error: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Notice that i call back a function in .Net from Visual Fortran (not another .Net) thanx a lotA.E.K