Calling unmanaged functions out of managed code

G

Guest

Hello

I'm currently developing a project, that contains one .net (VB) executable and a C++ (MFC) DLL. Now, what I want to do is to call the functions in the dll out of my managed code

//managed code (the .net executable
Public Class TestClas
<StructLayout(LayoutKind.Sequential)>
Class ANYSTRUC
Public counter1 As Int6
Public counter2 As Int6
End Clas

Declare Function MyTest Lib "test.dll" (ByVal param As ANYSTRUCT) As Boolea
End Clas

//[...
dim s as New TestClass.ANYSTRUC
//filling s with data..
TestClass.MyTest(s) '!!!

At this point, the debugger throws a System.NullReferenceException I cannot understand. Can anyone

Thanks a lo
Andrea

P.S.: This is the unmanaged code (in the MFC Dll)
typedef struct _ANYSTRUCT
__int64 counter1
__int64 counter2
}ANYSTRUCT

BOOL MyTest(ANYSTRUCT param

[...
}
 
G

Gary Chang

Hi Andreas,

Thanks for posting in the community.

I have posted a response to your problem in this queue, please check it.


Thanks!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top