Re: LabVIEW and C++ Pointers



Hi,
Like Paul, this topic also interests me. Here I'll tell about an experiences, hoping that it can bring just an idea.
in one of my last projects, I was using a DLL to capture the data from a miniPLC by using RS232 port. There were some objects like Digital inputs, digital outputs, analog inputs and outputs, function blocks status and etc that I used to read their data cyclically. there was a function in the DLL callled Read_Object and its prototype looked like this:
long Read_Object(unsigned char net_id, unsigned char object, unsigned short int index, unsigned char *data);
See the last parameter in line "data". it seems that "data" is a pointer to a byte. but it was the pointer to the first byte of an array which had different lengths for different objects. I think your problem is something like this. you have a pointer to a point of the memory, but this is the beginning point where a complex data srtucture lies. Is it not possible to feed an array of bytes (with definite length) to the DLL and then interpret the filled array after it has been processed by that DLL? I think there are two major problems with this idea.
1- the whole data will be copied once again in another place in the memory (I am pointing to initialized byte array)
2- interpreting the byte array to our complex data structure may be so difficult.
 
I hope it can be useful.
I've learned something new in this topic till now. hhmmm, Enjoying!
.



Relevant Pages