LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

can a dll remember state information?

Hello

I want to write a dll to read an excel file and return a 2D array of strings representing the contents. I do not know at the start how big this array is going to be. What is the best way of handling this. I thought of making two calls, one to find the size and the second to get the array. Or can I do the memory allocation in the DLL? (It's my first foray into DLL's)

The reason I'm writing a DLL is that some customers have Excel97 and others Excel2000. It's time we fixed this for once and all!

John

0 Kudos
Message 1 of 2
(2,582 Views)
Hi John,

The answer to your question is yes, there are several ways to handle state information in a DLL.

However, this application is probably not suited for a DLL. I suspect you would be better served in making ActiveX calls into Excel. There is at least one example that ships with LabVIEW that shows how to do this. Finally,

Finally, if you insist on writing a DLL, the best way to maintain the state information is to create some sort of structure or class and return a pointer to that class to LabVIEW. The call library node should be instructed to treat the pointer as a U32. LabVIEW can't access the data in the pointer, but it can pass the pointer on to the next DLL call, which can then dereference it and access the data.

Jason
0 Kudos
Message 2 of 2
(2,570 Views)