03-25-2014 11:54 AM - edited 03-25-2014 12:05 PM
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
03-26-2014 03:15 PM
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.
03-26-2014 03:31 PM
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'."
03-26-2014 03:46 PM
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.