LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Conversion of C++ to C

Hi,
I have a code written in C++, and I want to be able to use its functions in C by CVI.
I read in this forum about the option of registering DLL and then Creating an ActiveX Server for that use. unfortunatly when I register the DLL a failure pop-up appear. I used the Registration Utility provided in this site.
 
If someone has ideas how can I register the DLL (maybe compile it differently?) or another way of exporting these functions into C code, will be highly appreciable.
Ido
0 Kudos
Message 1 of 2
(3,245 Views)

Hi Ido,

You don't need to register anything when working with Win32 DLLs. You only need to worry about registration when you enter the realm of ActiveX (i.e. creating an ActiveX DLL).

So in order for you to use the C++ code in CVI, you need to create a DLL out of that code and make sure its C compliant (i.e. via the extern "C" statement).  Additionally, if your DLL has exported C++ class methods and properties, you need to go back to your C++ and export wrapper C Style functions (functions exported with extern "C") to be able to use them in CVI.  The extern "C" statement is required to instruct the VC++ compiler to not mangle the exported function names, which is what a C++ compiler does by default.


Hope this helps!

Best Regards,

 
Jonathan N.
National Instruments
0 Kudos
Message 2 of 2
(3,238 Views)