calling Visual C Dll in vb.net

danishce

Member
Joined
Apr 2, 2007
Messages
15
Programming Experience
3-5
I am using visual C dll in my vb.net application.how i pass vb.net buffer array to visual C pointer variable.I want to set the value of m_buffer variable which pass value to dll pointer variable buffer but it gives me the NullException error.(object reference not set to an instance of an object).my code is:

Imports System.Runtime.InteropServices
Dim m_buffer(1024) As Byte

<DllImport("mydll.dll", CallingConvention:=CallingConvention.StdCall)> _
Private Shared Function pckInitPack(ByVal idcode As Integer, ByRef buffer() As Byte) As Byte()
End Function

//form_load
pckInitPack(100, m_buffer)


if i use byval it set m_buffer value to zero.please guide me.
Thanks
 
Back
Top