LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Any reason why LabVIEW won't link DLL containing OpenMP commands?

Solved!
Go to solution

Hello,

 

I built a program in LabVIEW (Version 14.0.1f3) that takes images from a camera and does some processing to produce an output. The processing is through a DLL file created in C++ using Code::Blocks 16.01 linked to LabVIEW using a Call Library Function node. The program runs fine and does what I want it to. Recently I decided to try to speed it up by incorporating parallel processing using OpenMP since my machine has multiple cores. I obtain a successful build in Code::Blocks and the process runs fine there. However, when I try to link this modified DLL with LabVIEW, LabVIEW doesn't recognize it anymore. It says, "Library not found or failed to load". If I go back to Code::Blocks and take out the command to process a section of code in parallel, LabVIEW is able to link with the file. I would be grateful if anyone could help me understand why this might be happening.

 

Thanks

0 Kudos
Message 1 of 3
(3,084 Views)

Here's a short program that demonstrates the problem. It's adding two vectors together. The DLL generates two vectors of specified length and adds them together after multiplying one by some value. The length of the vectors and the value to multiply by are fed to the DLL by LabVIEW. The output is then fed back into LabVIEW. I get the error message in the attached file, basically it can't find the DLL. However, if I comment out the two lines in the C++ code beginning with #pragma, then LabVIEW links with the DLL and the program runs. The C++ code runs on its own as a console application (with the #pragma lines included) so it is unlikely that the problem is with the code.

0 Kudos
Message 2 of 3
(3,037 Views)
Solution
Accepted by topic author EM23

Apologies. It's not a LabVIEW problem. Because by including OpenMP commands the dll had to call other dll's I had to make sure they were all in the same folder. Basically copied and pasted the entire MinGW folder to where I saved the dll.

0 Kudos
Message 3 of 3
(2,989 Views)