calling C dll from VB.NET

  • Thread starter Thread starter netguy
  • Start date Start date
N

netguy

I'm coding a VB.NET application that calls a C dll. The VB.NET
application make a call to C dll to establish a session and inturn the
C dll returns a pointer to pointer.

function declarations
Declare Function C_sendData Lib "dataProcess" (ByRef ppControlArea as
integer, ByRef data() as Byte) as integer
Declare Function C_startSession Lib "dataProcess" (ByRef ppControlArea
as integer) as integer

'first call
dim ppControlAres as integer
C_startsesion (ppControlArea)

<- this call creates a session and returns ppControlArea (pointer to
pointer)

'second call
dim mydata () as byte
'initialize the mydata with some data
C_SendData (ppControlArea, data)
<- calling this function through an exception with error "Object
reference not set to an instance of an object"

I tried everything I know. Any help is appreciated...
 
I tried everything I know. Any help is appreciated...

Can you post the C function signatures? Passing the mydata array ByRef
is probably not the right thing to do.


Mattias
 
Back
Top