Calling LZO routines from VB.NET

P

Paul Ferrill

Has anyone successfully used the LZO compression utilities from
VB.NET? I'm trying to call them using DLLIMPORT and Declare but so
far haven't been able to get it to work.

When I use:

Declare Auto Function lzo1x_compress Lib "lzo.dll" (ByRef InBuff As
Integer, _
ByRef OutLen As Integer, _
ByRef OutBuff As Integer, _
ByRef InLen As Integer, _
ByVal iDum As Integer) As Integer

and then in the code do a:

Dim i, r, x, y As Integer
Dim ibuff(1024), obuff(2048), wrkmem(8192) As Integer
For i = 1 To 1024
ibuff(i) = Rnd()
Next
x = 1024
y = 1024
r = lzo1x_1_compress(ibuff(1), x, obuff(1), y, wrkmem(1))

Debug.WriteLine("Result " & r)

I get a System.NullReferencException occurred message.

tnx
 
H

Herfried K. Wagner [MVP]

* (e-mail address removed) (Paul Ferrill) scripsit:
Has anyone successfully used the LZO compression utilities from
VB.NET? I'm trying to call them using DLLIMPORT and Declare but so
far haven't been able to get it to work.

When I use:

Declare Auto Function lzo1x_compress Lib "lzo.dll" (ByRef InBuff As
Integer, _
ByRef OutLen As Integer, _
ByRef OutBuff As Integer, _
ByRef InLen As Integer, _
ByVal iDum As Integer) As Integer

Do you have the C++ headers for the library?
 
P

Paul Ferrill

* (e-mail address removed) (Paul Ferrill) scripsit:

Do you have the C++ headers for the library?

LZO_EXTERN(int)
lzo1x_decompress ( const lzo_byte *src, lzo_uint src_len,
lzo_byte *dst, lzo_uintp dst_len,
lzo_voidp wrkmem /* NOT USED */ );

LZO_EXTERN(int)
lzo1x_1_compress ( const lzo_byte *src, lzo_uint src_len,
lzo_byte *dst, lzo_uintp dst_len,
lzo_voidp wrkmem );
 

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