01-16-2010 01:46 AM
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
01-16-2010 11:38 AM
01-16-2010 01:14 PM
01-16-2010 03:36 PM
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
01-18-2010 01:43 AM - edited 01-18-2010 01:45 AM
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.