LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use a C++ class using directx libs in my cvi interface?

I have this class using directx libraries that allows me to retrieve status of my joystick in an MFC program. I would like to use this really good class in my cvi user interface, how can I implement it?
0 Kudos
Message 1 of 4
(3,463 Views)
You would have to build your C++ code into a DLL and extern "C" the functions you want to call. Or you could port your CVI code to Visual C++. We provide a wizard in Measurement Studio to do that.

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 4
(3,463 Views)
Thanks for the answer.
I built the dll file (using extern "C" on the class definition, not on the functions). How do I use the functions of this class in my CVI program?

Sorry for being so demanding, I'm a beginner in this field but my boss doesn't seem to care 🙂
0 Kudos
Message 3 of 4
(3,463 Views)
You woudl not extern "C" the class, you would need to extern "C" functions that will create your object and then call methods on it. CVI does not support classes since it is a C compiler, not C++. So have functions like Initialize that create an object of the class, and then wrapper functions to call member functions on the class. Then, extern "C" those functions and export them from the DLL. Then you will be able to call them from CVI.

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 4 of 4
(3,463 Views)