2
Answers

need help on how to pass address of an array to a dll(coded in c++)

Photo of donho1976

donho1976

20y
2.3k
1
HI.. i'm a newbie in using vb.net... need help on how to pass address of an array to a dll(coded in c++). i am just testing out my intended coding in a simpler code as shown below. code is somthing like this Public Shared Sub testpoint(ByRef N() As Byte) ' Leave function empty - DLLImport attribute forwards calls to testpoint to ' testpoint in test1.DLL. End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim c(20) As Byte testpoint(c) MsgBox(c(9)) End Sub *function to call in the test1.dll* void testpoint(char & output) { char * t = &output; t[9] = 'a'; t[10]='b'; } thks in advance... iceman11

Answers (2)

0
Photo of donho1976
NA 15 0 20y
ok thks... regards iceman
0
Photo of Adam Erstelle
NA 343 0 20y
If I remember correctly, arrays are always passed by reference, not by value. It should work just fine! Just delcare the dll's function, and use it as you want.