Home All Groups Group Topic Archive Search About

calling C dll from VB.NET

Author
2 May 2006 4:11 AM
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...

Author
2 May 2006 5:47 AM
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

--
Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.