LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DLL created by Labview 8 does not work in VB.net 2003

I don't know what I am doing wrong here: I have a control array as input and an indicator array as output, I have done as your documentation says, but I get only "zero" as output .
 
Here the VB program:

Visual Basic 2003 program:

'void LVdll(double arr1D_IN[], double arriD_out[], long len, long len2)

Private Declare Sub PArray Lib "C:\Documents and Settings\LAUDET\Desktop\TESTLVdll\SharedLib.dll" _
Alias "LVdll" _
(
ByRef iArray As Double, ByRef oArray As Double, ByVal len As Long, ByVal len2 As Long)

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim arrIn(5) As Double
Dim arrOut(5) As Double

For i As Integer = 0 To arrIn.GetUpperBound(0)
     arrIn(i) = 9 - i
Next

PArray(arrIn(0), arrOut(0), 5, 5)

End Sub
End
Class

0 Kudos
Message 1 of 5
(3,137 Views)
Well, I'm confused. The link you point to is about integrating LV 6 with VB6. But the rtf document you have is a modified version of what's on the web. Did you do the modifications?
 
The problem is that VB6 and VB.NET are very different and the statement you're using to define the external method call is incorrect for VB.NET. It isn't a DllImport statement and it isn't defining the array parameters.
0 Kudos
Message 2 of 5
(3,124 Views)

I did not change the documentation, but maybe I put the wrong links...I don't know...

Do you have any example about what you are saying? I can't find any and I am not a "geek", so I am not sure to understand it...

I don't know if it will help you to help me, but I am sending my test directory. As you would see, getting double output is easy, getting array output has wrong answer, and getting both of them in the same dll gave me an error.  But I guess that this is something to do with the .net ...

0 Kudos
Message 3 of 5
(3,116 Views)
The correct signature portion for your method statement is
 
(ByVal iArray As Double(), ByVal oArray As Double(), ByVal len As Integer, ByVal len2 As Integer)
 
And your call would be
 
PArray(arrIn, arrOut, 5, 5)

Message Edited by Lycangeek on 06-21-2006 11:57 AM

0 Kudos
Message 4 of 5
(3,112 Views)

It works!

Thank you very very much!

Smiley Very Happy

0 Kudos
Message 5 of 5
(3,103 Views)