calling C dll from VB.NET

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...
 
M

Mattias Sjögren

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
 

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