external function with array of strings parameter 
Author Message
 external function with array of strings parameter

Hi,
i have dll with function, that one of its parameters is array of
strings (char**). I don't know how can i call this function, because
LV let me select only string, but not array of strings?


Mon, 06 Sep 2004 01:04:51 GMT  
 external function with array of strings parameter
Hi,
i have dll with function, that one of its parameters is array of
strings (char**).
I don't know how can i call this function, because LV let me select
only string, but not array of strings?


Mon, 06 Sep 2004 01:05:57 GMT  
 external function with array of strings parameter
You could try setting the variable type to 'adapt to type' This may
work, but note, if your dll trys to modify the string array, you may
run into problems with the labview memory manager... Basically (I
think I'm correct on this...) labview stores strings in a format where
consisting of the start address and number of bytes to follow... If
something alters this string out of the control of labview, lv's
memory manager gets all stroppy and usually kills labview...
May not be a problem in your case, but if labview suddenly starts
crashing when you run a function from this dll, that may be the reason


Mon, 06 Sep 2004 20:05:20 GMT  
 external function with array of strings parameter
Thanks.
I already avoided this problem.
I simply transformed string array to one string where symbol (13)
separates between strings.


Mon, 06 Sep 2004 20:36:24 GMT  
 external function with array of strings parameter
Well, the array of strings is just an an array of pointers to strings,
which in LabVIEW can be assumed to be just an array of 32 bit
integers.  The problem is that those string pointers have to map to
valid places in memory.  That means we need to generate valid string
pointer in LabVIEW and build them into an array.  There are two ways I
know of to do this.  One is to use the lstrcpy function from the
kernel32.dll which copies a string into another and returns a pointer
to the string if successful.  You can also use a VI from the Pointer
Utility Library to do the same thing:

http://zone.ni.com/devzone/explprog.nsf/webmain/C94071199E8F18AD86256...

If the strings are inputs to the function, then you would insert the
proper strings before calling the DLL function.  If the array is an
output, then you will have to make sure each of the strings is large
enough for what will be put into it.

Alternatively, you can of course make a wrapper function for calling
the DLL from LabVIEW.



Tue, 07 Sep 2004 02:47:46 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. external function with array of strings parameter

2. Q: Passing stem array to external function?

3. parameter array of strings

4. Problem of passing string parameter in DLL's function from a C application

5. Arrays as parameters to tasks/functions?

6. Beginner's question (array parameters to functions)

7. Strings in function parameters -- Thanks for all!

8. Strings in function parameters?

9. SOLVED | optional string parameters to a C++ extension function

10. FORTRAN dynamic arrays used as parameters of functions called from C++

11. Array to String and String to Array

12. parameter syntax for array parameter

 

 
Powered by phpBB® Forum Software