LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

problems in calling C++ dll

Solved!
Go to solution

Hi, I built a dll in C++ to write data to a shared data segment, and it works well in Labview. Then I try to call the Dll in C++, it can be successfully built but will break in the end. I have been in this problem for almost a whole day and couldn't find the solution. 

 

Below is the source files of my Dll and dynamically calling program.

 

Dll:

Capture1.PNG

 

Calling program.

Capture2.PNG

0 Kudos
Message 1 of 6
(3,442 Views)

So, now you want people to help you with C++ calling a C++ DLL problem here on a LabVIEW message board?

0 Kudos
Message 2 of 6
(3,439 Views)

Your Store subroutine indicates e is an array of 7 elements.

Your calling subroutine passes the address of the last element in the array (&e[7]).  Try &e[0].

 

 

George Zou
Message 3 of 6
(3,426 Views)

thank you for your reply as I know the question is not very "Labview". I changed the array address like you said and the problem is still there. Attached is my calling program and dll, could you have a look at it for me please?

0 Kudos
Message 4 of 6
(3,414 Views)

For C/C++ issue, you would be better help in the LabWindows/CVI group:

http://forums.ni.com/t5/LabWindows-CVI/bd-p/180

 

George Zou
Message 5 of 6
(3,357 Views)
Solution
Accepted by topic author Xinghe.W

Problem solved.  The working dll for both C++ and Labview should be like this. The shared data segment should also be declared like funtion and with "extern "C"" ahead. In addition, Labview can only read pointers from dll.

 

Capture.PNG

0 Kudos
Message 6 of 6
(3,313 Views)