07-12-2005 11:51 AM
07-12-2005 11:59 AM
You've answered the question yourself.. 😉
You can send an array of strings. You may have to format it appropriately, which you can do using the string manipulation tools.
JLV
07-12-2005 12:17 PM
07-12-2005 12:42 PM
07-12-2005 01:09 PM
07-12-2005 01:14 PM
07-12-2005 01:21 PM
The double star means a pointer to a pointer (a double pointer), right? I believe that pointers to pointers are really not something that LabVIEW can deal with. You will need to write a wrapper in C and call it from LabVIEW. In the wrapper, you will need to dereference at least one level of pointer.
I hope that this helps,
Bob
12-13-2006 01:32 AM
elliot.ee wrote: I guess the real question is in the Call Library Function Node, how do you force the input param to be a char** ?
Well you can't directly and doing it all on LabVIEW level is a very messy and involved process just not worth the trouble. The extra difficulty here is that char **var really also can mean char *var[n] or even char var[m][n] which are equivalent as far as the C compiler itself is concerned but quite a bit different as far as memory management and access constraints are concerned.
The "simple" solution (and believe me it is a lot simpler than trying to do it otherewise on the LabVIEW diagram level) is to write a wrapper function along these lines:
struct {
int32 len;
LStrHandle str[0];
} LStrArr, **LStrArrHdl;
MgErr CallStrArrFromLabVIEWArr(LStrArrHdl arr) {
int i, len;
LStrHandle h;
char **p = DSNewPClr(((*arr)->len + 1) * sizeof(char *)));
if (!p) return mFullErr;
for (i = 0; i < (*arr)->len; i++)
{
h = (*arr)->str[i];
len = LStrLen(*h);
p[i] = DSNewPClr(len + 1) * sizeof(char)));
if (!p) goto exit;
MoveBlock(LStrBuf(*h), p[i], len);
}
CallToStrArr(p);
exit:
for (; i; i--)
{
if (p[i]) DSDisposePtr(p[i]);
DSDisposePtr(p);
}
return noErr;
}
Rolf Kalbermatter
12-13-2006 09:59 AM - edited 12-13-2006 09:59 AM
Message Edited by tbob on 12-13-2006 09:01 AM