Very simple question

T

Tomaz Rotovnik

How can I get array of unsigned char from VC++ dll to VB

For example:

I declared next function in VC++ dll:
int funct(int size, unsigned char* array)

I want to read the contents of array in VB

Public Function Func(ByVal size As Long, ByRef array As Byte) as Long

What should I do to read an array

Whay is this wrong?
Dim ar1(10) As Byte
For i = 0 To 10
ar1(i) = array(i)
Next i
 
R

Richard Grimes [MVP]

Tomaz said:
Public Function Func(ByVal size As Long, ByRef array As Byte) as Long

I am not a VB.NET expert, but in VB.NET aren't array parameters declared
with parenthesis? Something like this:

Public Function Func(ByVal size As Long, ByVal array() As Byte) as Long

C++ treats arrays as contiguous blocks of memory, .NET treats them as
objects, so you should declare a Byte array object not a Byte pointer.

Richard
 

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