LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using C++ code into LabVIEW

Hi..We got a huge library written in C++. We want to use that library in to LabVIEW. As per I know there are two ways to do that
(1) DLL      (2) CINs
We don't want to use CINs for some reasons. I know DLL is the best way to call C++ functions into LabVIEW but the problem with
DLL is, DLL have some restrictions like can not have static pointers. If we want to have static data then we have to define those static
data into .def file and use it etc. It may create problem with C++(May be).
 
Is there any way, we can use all the C++ code into LabVIEW. I don't know much about COM. Is COM can do that job?
 
Please let me know anyway I can use full featured C++ Library into LabVIEW.
 
Thanks in advance....
0 Kudos
Message 1 of 2
(2,427 Views)

@prayami wrote:
Hi..We got a huge library written in C++. We want to use that library in to LabVIEW. As per I know there are two ways to do that
(1) DLL      (2) CINs
We don't want to use CINs for some reasons. I know DLL is the best way to call C++ functions into LabVIEW but the problem with
DLL is, DLL have some restrictions like can not have static pointers. If we want to have static data then we have to define those static
data into .def file and use it etc. It may create problem with C++(May be).
 
Is there any way, we can use all the C++ code into LabVIEW. I don't know much about COM. Is COM can do that job?
 
Please let me know anyway I can use full featured C++ Library into LabVIEW.
 
Thanks in advance....


LabVIEW can not interface directly to C++ DLLs. Also CINs and DLLs are technically really almost the same (A Windows CIN is really a DLL with a specially exported interface only). However CINs are legacy technology and should not be used for new designs.
 
I do not understand what you want to do with static data that needs to be exported. static variables are by definition not externally available outside of the module that defined them.
 
You have therefore following possibilities:
 
1) Write wrapper functions for all C++ methods you want to call and export them as standard C fucntions from your DLL or a second wrapper DLL that links to your C++ DLL. Make sure to use the same compiler you used for the C++ DLL when compiling a second wrapper DLL. The C++ binary interface is not compatible between certain C compilers from different manufacturers.
 
2) Add an ActiveX interface to your C++ DLL and call it through LabVIEWs ActiveX interface functions. Depending on your familiarity with ActiveX this might be simpler but I cant comment on this since I never have done it.
 
Rolf Kabermatter

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 2
(2,402 Views)