LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a C++ object in a DLL from LabVIEW

Hi, 

 

I would like to know if someone has successfully called a C++ object in a DLL from LabVIEW using a C wrapper or any other method?

 

I have find a good article on the internet on how call things from C++, see link below

http://labviewwiki.org/DLL/shared_library

Unfortunately it doesn’t say anything about calling an object. It really just covers calling a simple number or string.

 

A short example code would be greatly appreciated.

 

Many thanks,

Christophe 

0 Kudos
Message 1 of 5
(4,430 Views)
What do you mean by "calling an object"? Given the example in that link, what would you be wanting to do? Any class-based operation would require a wrapper function, which is what that example shows.
0 Kudos
Message 2 of 5
(4,420 Views)
I've been working with this type of challenge.  Are you looking for an example of dll code that specifically calls an object or pointer to an object in C++ that can be imported into LabView?
0 Kudos
Message 3 of 5
(4,408 Views)

Hello,

 

I am looking for an example which calls an object but I would also be happy with code for a pointer to an object. My problem is I am not a C++ programmer, I have done some C before but nothing advanced.

 

Ideally I'd like a full example with a VI, the C wrapper and a DLL which could bring me up to speed.

 

Christophe 

 

0 Kudos
Message 4 of 5
(4,397 Views)

christophe74 wrote:

Hello,

 

I am looking for an example which calls an object but I would also be happy with code for a pointer to an object. My problem is I am not a C++ programmer, I have done some C before but nothing advanced.

 

Ideally I'd like a full example with a VI, the C wrapper and a DLL which could bring me up to speed.

 

Christophe 

 


Well the link you showed is about as examplish as it can get in terms of wrapping a C++ object into a standard C function library so it can be easily called by the LabVIEW Call Library Node.

 

You basically need a function for the instantiation (creation) of the object which returns a pointer to the instantiated object and one for the destruction of the object and then wrapper functions for any object method and public variable (property) that you want to be able to access and that is just what that example shows.Where are your problems?

 

You say you have done C before so I don't think it is about how to get a project or makefile setup to compile such a wrapper DLL at all. Also the calling of that wrapper through the Call Library node shouldn't be a real problem either if you know the basics of C and its datatypes.

 

Explain yourself more in detail and show what you have tried to do so so far.

Message Edited by rolfk on 01-18-2010 08:45 AM
Rolf Kalbermatter
My Blog
Message 5 of 5
(4,373 Views)