10-22-2003 10:37 AM
10-23-2003 10:22 AM
10-23-2003 11:02 AM
10-23-2003 01:37 PM
08-25-2006 09:16 AM
08-19-2020 03:02 AM - edited 08-19-2020 03:11 AM
@mboyle wrote:
This example is exactly the information that I am needing.
When using this LStrHandle allocation code, what LabVIEW dll must be linked to and how? I can not find any documentation about linking to LabVIEW from C applications.
There really isn't. It's not just about linking to lvrt.dll an then you are done with it. lvrt.dll needs to be instantiated properly in order to have all its things properly setup. This typically happens if you start a LabVIEW build application.
labviewv.lib is the import library for the LabVIEW manager functions. It implements so called weak linking which means it only attempts to link to a function the first time it is called. It basically checks if the function pointer is already initialized and if that is not the case it checks if either labview.exe or lvrt.dll are already loaded into the process space and then imports the function from that module. And you can't just load lvrt.dll yourself into memory and hope to have its functions available since there is a whole series of initialization steps that the LabVIEW build executable does in order to setup all the different DLL resources.
When you see that error it basically means that the labviewv.lib loader routine tried to find labview.exe or lvrt.dll loaded into memory and it failed. That only really can happen if your process is not a LabVIEW application and then the big question actually is, WHY do you want to use LabVIEW memory management functions in C code that does not run in the context of a LabVIEW application (either the LabVIEW development environment or the LabVIEW runtime engine)? It doesn't really make much sense to create such data elements unless you want to pass them to LabVIEW somehow and that will only work if there is a LabVIEW engine already running in your process.