
How to handle a return pointer to an array from a DLL
Just copy it back into a VB array.
Redim yourarray(0 To numelements - 1)
CopyMemory ByRef yourarray(0), ByVal ptr, ByVal numelements * sizeof(single)
You cannot change the address of a VB array, so you'll have to copy it
if you do not want to pass the array by ref.
To receive the pointer from your C function, pass a Long by Ref.
Hope this helps
Alexander Kienzle
Quote:
> I have a DLL function that returns a pointer to an array
> of single values, how can I handle this function call in
>
Visual Basic? Can visual basic receive a pointer to an
> array from a DLL. I know that I can pass a reference to a
> vb array to a DLL function, but can it work the other way
> around?
> Thanks