LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Want to pass 2D integer array from VB 6.0 to LabView (v 8.0) DLL

I was able to pass 1D arrays from VB 6.0 to LabView 8.0 with no problem.  I checked the literature for help regarding 2D arrays and found
scant help unless it was for VB.NET, C or single dimensional arrays.  Thanks.
 
I wrote a simple test VB program to pass 2D arrays shown below after which I get a memory crash:
 
----------------------------------
 
Private Declare Sub Test2D Lib _
    "C:\Documents and Settings\Owner\My Documents\builds\Test2DArray\Test2DArray\Test2DArray.DLL" _
    Alias "Test2darray" (ByRef varInArray As Variant, ByRef varOutArray As Variant)

Private Sub cmdStart_Click()
    On Error GoTo handle_error
    Dim intInArray(8, 😎 As Integer
    Dim intOutArray(8, 😎 As Integer
    Dim varInArray As Variant, varOutArray As Variant
    Dim i As Long, j As Long, k As Integer
   
   
    For i = 0 To 7
        k = i * 8
        For j = 0 To 7
            intInArray(i, j) = k + j
        Next j
    Next i
   
    varInArray = intInArray
    varOutArray = intOutArray
    Test2D varInArray, varOutArray
    Exit Sub
   
handle_error:
    MsgBox Err.Description, , ""
End Sub
------------------------

In the Labview DLL I have a definition of the exported function call as:
void Test2darray(TD1Hdl * InArray, TD1Hdl * OutArray)
 
(in the Labview DLL I take the input array, add 1 to each of the elements and then stuff it into the output)
 
 
Message 1 of 2
(2,569 Views)
0 Kudos
Message 2 of 2
(2,556 Views)