LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos
dafemec

Accommodate C++ Class DLLs

Status: Declined

Any idea that has not received any kudos within a year after posting will be automatically declined. 

The current interface for DLLs does not nicely accommodate C++ classes.  For instance, there is no inherent mechanism for passing in and out of DLL calls the reference to an instance of a class.

3 Comments
GregR
Active Participant

While C++ is a standard at the language level, it does not specify the binary level. The result of this is that each compiler is free to implement its own object and virtual function table layout. This creates particular problems for LabVIEW in knowing how to treat the actual memory before calling a constructor or destructor and accessing the virtual function table to call a virtual method. Without standards at that level, LabVIEW can't in general support C++ classes from the call library node. We simply can't know how to generate the code correctly.

 

On the other hand if you only expose static or at least non-virtual instance methods from your class, you may be able to call it from a LabVIEW diagram. In general you can pass C++ object pointers around LabVIEW diagrams as pointer sized integers. Static methods are called like any C function. For non-virtual instance methods, you should be able to pass the object reference as the first parameter on the node, followed by any other parameters.

PietH
Member

A lot of fantastic extern libraries are C++ based projects. The most of this libraries are "Open Source" and also so called "CMake Projects". 

With CMake you can decide which C++ compiler should be used to create a C++ Project. 

 

If LabVIEW would support a particular compiler (i.e. MSVC++ 2009), it would be technically possible? I know that NI and Microsoft cooperate very well with each other. Maybe it should be possible in future versions of LabVIEW? Are there any plans from NI to do this?

 

An option to call virtual C++ methods would increase the functionality of LabVIEW enormous! An example: The DICOM Toolkit (dcmtk, Offis Institute Oldenbourg Germany) is the defacto standard for DICOM, and is used in many applications worldwide. DCMTK is open source and free to use, but contains a lot of virtual methods. With the integration of this toolkit, it would be easy to develop a Picture Archiving and Communication system with LabVIEW! Very interesting for a lot of users who are working in the medical field ...Smiley Happy

Darren
Proven Zealot
Status changed to: Declined

Any idea that has not received any kudos within a year after posting will be automatically declined.