Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have a DLL which is compiled from C which I need to use in vb.net.

 

So far I have this:

 

Declare Auto Function UnCompress Lib "lzss.dll" Alias "_uncompress_data" (ByVal Data As String, ByVal Length As Integer) As String

 

But when trying to run this:

 

dim out as String = UnCompress(indata, len(indata))

 

I get the following error message:

 

An unhandled exception of type 'System.NullReferenceException' occurred

 

Additional information: Object reference not set to an instance of an object.

 

The C declaration of this function is as follows:

 

unsigned char __declspec(dllexport) *uncompress_data(unsigned char *inbuf,int *buflen)

 

What am I doing wrong?

Posted

Try This

 

Declare Auto Function UnCompress Lib "lzss.dll" Alias "_uncompress_data" (ByVal Data As String, ByVal Length As Integer) As String

 

UnCompress(indata, len(indata))

 

dim out as String = indata

Posted

OK then try this

 

Declare Function UnCompress Lib "lzss.dll" Alias "_uncompress_data" (ByRef Data As String, ByRef Length As Integer) As String

 

UnCompress(indata, len(indata))

 

dim out as String = indata

Posted
it's an array of chars, but changing the type to Char() makes no diffrence and if you change the returned type to Char() you get a 'Could not marshal the return data type' error
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...