Click to See Complete Forum and Search --> : How to call a structure that contains C double pointer(**) from VB6 or VB.NET?


come2me100
December 10th, 2002, 12:38 AM
Ifm working on library function development using C language.
I want to use the created function from VB6 and VB.NET also, but so far not succeeded.
The interface of the function contains structure, and it has double pointer (char**) inside. The structure as follows:
typedef struct _MYMsg {
int nNumMSG;
char** MystrMsg;
} MyMsg;

The value inside of the structure is treated as character string and is used within the library function. So, it is passed from VB6 or by VB.NET by specifying string.

Currently, 6 of 51-byte-string are used within the library function as fixed.
I want to pass those strings from VB6 by specifying.


In VB6, the structure was declared in 2 ways as follows:
1. declared strings in 6*51-byte array
Public Type myMsg
mystrMsg As Integer
strMsg(0 To 5) As String * 51
End Type
2. declared strings in pieces
Public Type MyMsg
mystrMsg As Integer
strMsg0 As String * 51
strMsg1 As String * 51
strMsg2 As String * 51
strMsg3 As String * 51
strMsg4 As String * 51
strMsg5 As String * 51
End Type

Both of the above, even the value of mystrMsg within the library function, were broken.

[Question]
I would like to get the area of strings by VB and Vb.NET and pass it to C function as parameter.
Which method of the above is correct to declare structure that include double pointer?
Is it possible to declare double pointer in VB6 or VB.NET?
If not please some can explaing me why?
Thank you u in advance.