LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

questions about "call library function node"

Hello,

After searching for quite some time, I still can't find a satisfying answer to my problems.

Here are the questions I have about the "call library function node":

1. Is it possible to create - with one function call to a dll - an object and keep it so that later, I can call one or more of its methods? Or is all the memory the "call library function node" allocated for the dll de-allocated as soon as one function call is done?

2. Is there a limit for the amount of memory that a dll can allocate?


I hope that, looking through so many threads, I didn't overlook the one that does actually already answer these questions...


Regards,
[J]

0 Kudos
Message 1 of 5
(2,769 Views)

I believe that the answer is probibly yes, but it may depend on the DLL.

 

I have created VIs to access the SQLite3.dll. When you open a database connection you get back a handle to a memory space. I can get this pointer back into the LV environment and pass it sucessfully to other dll calls. It doesn't get deallocated unbtil I call a specific dll function that closes the connection.

 

Is this helpful?

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 2 of 5
(2,746 Views)

As Mike stated the answer is yes and it will depend on how the DLL is implemented itself. We have a DLL that stores state information that is used by other calls to the DLL. If you are writing teh DLL yourself you may want to make it thread safe as well or force it to a particular execution thread.

 

As for the memory limitation that is basically limited by the resources of the machine.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 3 of 5
(2,739 Views)

Thanks a lot for the answers! Yes, I think that's helpful for what I'm doing.

 

I have another question concerning this topic: Can I allocate memory within one of the dll functions? Or does every memory that I need to process my functions have to be allocated within LabVIEW?

 

Regards,

[J]

0 Kudos
Message 4 of 5
(2,678 Views)

Very similar answer to the last one. The drivers I mentions do exactly that,  but the sqlite dll is very well behaved. Still there are times that you have to allocate memory by passing in an array or string.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 5 of 5
(2,673 Views)