How to passing variables from c++ to vb.net

90 Views Asked by At

I have

c++ api function :

 `int readMemory(unsigned int address, unsigned char** data, unsigned int size);` 

I want to translate it into vb.net function:

Public Function readMemory(
        ByVal address As UInteger, ByRef data As IntPtr, ByVal size As UInteger) As Integer
End Function

When I call readMemory function in vb.net:

Dim startAddress As UInteger = &H801FFFA
Dim dataStruct As IntPtr 
Dim size As Integer = 1
Dim readMemoryFlag As Integer = 0
 
 readMemoryFlag = readMemory(startAddress, dataStruct, 0)

Then I getting

access violation exception

. When I declare startAddress as Uint64 then I not getting the exception but size is very random. Any help ?

0

There are 0 best solutions below