-
I have a function in a c++ dll that gets a pointer to double array. inside a struct.
I defined a UDT in VB5 and passed all the rest of the UDT fields fine, the problem is with this array.
type Type1
par1 as Integer
myArr as double
end type
dim myType as Type1 , arr() as double
ReDim arr(1000)
I don't know how to set myType.myArr to point to arr
if I pass the array seperetly it's easy and it works but I need it in the UDT.
CALL dllfunction(myType,arr(0))
Is this posible???
HELP
Shai
-
Why don't you Dim the UDT variable directly?, eg.
Code:
Type Type1
Par1 As Integer
myArr() As Double
End Type
Dim myType As Type1
ReDim myType.myArr(1000)
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
I have tried this with no success.
I don't know if this is my fault or it's not the right way.
I will make myself clear.
the dll is waiting for a UDT with a pointer to a double array.
???????????????????????
-
I see, you want to pass a pointer, not the actual array..
In that case your only option would be to use one of the Undocumented and Unsupported Pointer Functions in VB, like VarPtr() to give you the Pointer to a Local Array which you can store as a part of a User Defined Type.
Something like:
Code:
Type Type1
par1 As Integer
myArr As Long
End Type
Dim myType As Type1
Dim Arr(1000) As Double
myType.myArr = VarPtr(Arr(0))
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
10x for the help VarPtr() is working fine!
Shai