NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to instantiate objects from a MinGW C++ DLL ?

Hello,

 

I have developed a C++ Windows DLL with Eclipse / MinGW GCC; this DLL is an API exporting a lot of data object pointers like this:

mynamesapce::myAPI api;
myData * data = api.getAllData();
data->getName();
//and so on...

I need to import this DLL in NI TestStand 2014 and use all the data objects exported by this DLL.

I have inserted an Action in the Sequence Editor with a C/C++ Adapter and imported the DLL. Then, I can see the mangled names of all exported classes and methods.

But I don't know how to use these names to get my data objects.

I have read in the following Help: "Exporting Class Methods and Functions in Microsoft Visual Studio" 

"The C/C++ DLL Adapter does not allow you to call public non-static methods."

 

Does someone know if it is possible to use C++ DLL classes (notably compiled with MinGW GCC) ?

Thanks in advance for your answers.

 

Best regards,

Pascal

 

0 Kudos
Message 1 of 3
(5,482 Views)

To use a C++ class from TestStand, you will need to write C or C++ wrapper functions using static methods or top-level functions. TestStand does not know how to create or destroy objects of a C++ class. You can store the pointer for a C++ class in an Object Reference variable, but you will have to expose an API that creates and destroys such objects as well as exposes the functionality you require via static methods or top level functions.

 

Hope this helps,

-Doug

0 Kudos
Message 2 of 3
(5,409 Views)

Doug,

Thanks for your answer which confirms what I thought.

As my C++ DLL contains thousands of exported classes, it's too much work in my context to wrap all these classes in C or C++ static functions.

I think I am going to wrap my C++ DLL in a .NET assemby (using Visual C++/CLI and not GCC) whose classes can be read by TestStand.

Best regards

Pascal

0 Kudos
Message 3 of 3
(5,401 Views)