From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
05-25-2011 12:54 PM
Hi All,
I've inherited LV code that calls a CIN node to access a motor controller. I'd like to compile this code to a .NET DLL, but receive the following error when calling it from an external source:
I've read the knowledgebase article explaining the problem from here, as well as the following support questions:
http://forums.ni.com/t5/LabVIEW/Labview-lib-was-not-called-from-a-labview-process/m-p/232548
http://forums.ni.com/t5/LabVIEW/Labview-lib-was-not-calld-from-a-labview-process/m-p/718427
http://forums.ni.com/t5/LabVIEW/Building-a-LabVIEW-DLL-with-VIs-that-use-CINs/m-p/632817
The conclusion seems to be recompiling is the answer. I've tried recompiling the original CIN vi within LV with no success. Do they mean to recompile the original C code against the newer labview.lib (sorry, I'm not all that familiar with how the CIN nodes work)? Any suggestions would be awesome. Thanks.
-Joe
05-26-2011 02:41 AM - edited 05-26-2011 02:48 AM
You can't make use of LabVIEW manager functions in non-LabVIEW based processes. Basically unless the C code is for a CIN or DLL that is to be called by LabVIEW (inside the development system or a LabVIEW built application), any function pulled in from labview.lib is not available. LabVIEW.lib is an import library that does not implement any functions but simply imports them from the LabVIEW kernel, either the LabVIEW development system or the LabVIEW runtime DLL. And no you can't just link in the LabVIEW runtime DLL into your .Net application. This DLL needs to be started up and initialized in very specific ways, that only LabVIEW itself knows about when building an application.
Basically if you want to recompile the code (yes in C/C++) for use in a non-LabVIEW application, you also have to remove all the link libraries from the LAbVIEW cintools directory, and replace any use of functions now unavailable (link error: unavailable external reference) with other similar functionality from your C runtime library. Or implement those functions yourself using C runtime library calls.
Another possibility could be to actually create a LabVIEW executable that exports the functionality as ActiveX Server. Or in LabVIEW 2010 you could also select to create a .Net Interop Assembly from inside the LabVIEW project.
05-26-2011 01:21 PM
Thanks for the help. I was able to find a DLL from the same 3rd-party company that has the same functions as the CIN. So it's resolved for me.