Very simple question

  • Thread starter Thread starter Tomaz Rotovnik
  • Start date Start date
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
 
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
 
Back
Top