LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

string array from .net wrapper function

I am using a wrapper function created by the .net controller for a C# dll.  A function of the dll has a string array argument in C#.  The function prototype of the wrapper function for this string array turns out to demand a

 

char ***array

 

for this parameter.  This seems to be different from what CVI Help's sample code demonstrates i.e.

 

// in C#

public double[] MyArrayMethod(string[] array, ...

 

// in CVI 

char * array[]={"a", "b"};

MyArrayMethod(aHandle, array, ...

 

I tried it anyway and got an error message saying

 

Type error in argument 2 to `MyArrayMethod'; found 'pointer to pointer to char' expected 'pointer to pointer to pointer to char'.

 

How should I declare and initialize this variable to use the wrapper function?

 

Thanks

 

0 Kudos
Message 1 of 4
(4,747 Views)

An array of strings is often passes as

 

char [numStrings][maxSizeOfStrings]

 

or the array of strings is condensed into one string and passed with an array of offset values so the function can parse the string.

 

Let us know if the char [][] works for your function or if you needed to go about it the long way and change the function call and only pass one large string. 

0 Kudos
Message 2 of 4
(4,706 Views)

Thanks for the reply.

 

I tried 

 

char *array[2][10]={0};

MyArrayMethod(aHandle, array, ...

 

and got

 

"found 'pointer to array 10 of pointer to char' expected 'pointer to pointer to pointer to char'."

 

0 Kudos
Message 3 of 4
(4,703 Views)

try char array [][] and not char *array[][].

 

Also if it is expecting a "pointer to pointer to poiner to char" it might be looking for char **array[] or even char***

 

If you are still having trouble, post some code (the dll you are calling and the .c file that calls it) so we can take a look at it. 

0 Kudos
Message 4 of 4
(4,701 Views)