From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labview call dll compiled by CVI

I'm trying to call a dll that generated by CVI,  meanwhile CVI use  function "LoadLibrary" to call another dll compiled by C,  like nested call.

 

source code like below:

==================

point = LoadLibrary("MXIO.dll");
==================

 

While I call the dll in labview,  labview always popup a window that show "point is null " and labview break down.

 

If I use CVI call the dll, no error showed and running ok.

 

Any compile I need to notice, thank you at advance.

0 Kudos
Message 1 of 3
(2,488 Views)

for some reasons the edit ended up as double post

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 3
(2,407 Views)

LoadLibrary() can fail for a lot of reasons, the most likely being that it can't find the DLL you specify or one of its dependencies. Specifically if you just specify the DLL name as in your example, that DLL can only reside in a few specific locations on your system in order for the Windows LoadLibrary() functions to find it.

 

Those locations are among others:

1) The application directory (if you run your VI in the LabVIEW IDE it is the directory where your LabVIEW.exe is, e.g. C:\Program Files\National Instruments\LabVIEW 2016)

2) The Windows directory

3) The System directory

4) any directory that is listed in your PATH environment variable

 

If you do not want to put your DLL in any of these places you have to determine its path somehow at runtime and pass the entire path to LoadLibrary().

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 3
(2,401 Views)