05-17-2004 12:10 PM
05-18-2004 05:07 AM
05-19-2004 04:35 AM
05-19-2004 05:37 AM
05-19-2004 06:16 AM
05-19-2004 08:07 AM
05-19-2004 08:07 AM
05-19-2004 08:07 AM
05-12-2007 05:58 PM
@rolfk wrote:
@ivan_div wrote:
> Hello,
>
> I'm trying to find out how to define an array, and send a pointer to
> it.
> In other words: I've imported a DLL (written in C++), and one of its
> functions needs a pointer to an array as an input.
> Let's say I have the array I need... Do I have to allocate a memory
> for it, and pass the pointer to that memory location to the dll?
> I've read somewhere on this site, that the only way to work with
> pointers in LabVIEW is by using the "call library function". Is there
> any way to create an array and a pointer to it in labview without
> going through the call library functions?
Well you will have to use the Call Library function to call your DLL
function won't you? 😉 Ohh I see you created an Active X interface
for the DLL, ohh my God!
If you would call the DLL fucntion through Call Library Node instead,
LabVIEW would do all the work for you. Or have the ActiveX method take
a string or variant value instead.
> Even if that were the only way, can anybody help me to get started?
>
> In the attached VI, using "Invoke Node" I call a function named "Set
> Data". The function has 2 input variables:
>
> 1. pbyData - This is the pointer (type U8) to a buffer that contains
> the array;
> 2. wDataLength - The length of the array.
>
> What should I connect to these 2 inputs?
Create an Array of U8 integers with the Initialize Array function. Wire
that array to a Call Library Node (CLN) setup as following:
Library Name: LabVIEW
Function Name: MoveBlock
Calling convention: C decl
return value: void
1. param: source, array of U8 pass as LabVIEW array handle
2. param: target, uInt32, passed by reference
3. param: length = 4
The final array pointer (param2 output) incremented by 4 is now what you
want to pass to your ActiveX method together with the intial length of
the array.
NOTE!!: Make sure the array you intialized stays valid until after the
ActiveX method returns. This means for instance wiring the right side of
the first parameter of the CLN to a sequence frame which also somehow
depends on the ActiveX node having been executed (error cluster output
to the same frame wired) and don't branch the array wire before you
arrive in that (sequence) frame.
Rolf Kalbermatter
>
> Thank you in advance,
> Ivan
05-13-2007 02:13 PM