LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use a namespace in a C++ code communicated with labview

I have a long code written in c++.  Now I want to acquire data with labview, send some data points as an entry to my c++ code and it will return a value to Labview.  I tried with a simple sum of two elements and it worked, but in my long code I have so use some namespaces and subfunctions.  If I try to compile it does not accept a namespace such as std.
 
Can anybody help me?
 
 
0 Kudos
Message 1 of 4
(2,967 Views)

Hi,

How did you implement the sum of two elements? I will suggest you convert the C++ code to a shared library (dll) and call the dll from LabVIEW using the "Call Library function Node". With this function, you can specify the dll function with the input and output parameters.

Tunde

Message 2 of 4
(2,950 Views)
Yes I created a dll with a simple that adds two numbers, but when I try to include a more complicated code the compiler fails.  You can check the attachment.
0 Kudos
Message 3 of 4
(2,942 Views)

I'm not certain the difference (and there isn't an attachment). However, if the functions you are exposing from your DLL are not marked as extern "C", then you'll have a lot of difficulty calling it from LabVIEW. You don't want to deal with the C++ name mangling, so keep the API simple and straight C. Behind the function signature, however, you can use whatever you want.

If you are already doing this, can you answer the following

1. What, exactly, is going wrong?

2. What version of LV?

3. What version and platform is the C++ compiler?

0 Kudos
Message 4 of 4
(2,918 Views)