LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with calling a LV created DLL from C++

Hi there,

I tearing my hair out (well what reamins of it anyway) trying to get Microsoft Visual C++ to successfully call a function in a dll I created in LV. To illustrate the problem I've been trying to get the problem as simple as possible, I've now got it down to a VI which just assigns a constant to an indicator. This is then built into a DLL by the application builder.

The LV generated header for the Constant function looks like:

void Constant(double *Numeric, double *Numeric2)

 

I then copy the .h file, the .dll file and the .lib into the directory with my c++ files in, add the .h file and the .lib files to the c++ project and then call in my C++ routine like:

 

double N1; double N2;

...

Constant(&N1, &N2);

 

The c++ compiles and links ok but the value of N1 and N2 doesn't change from their un-initialized condition.

I can call the function ok from within labview using the call_dll vi and get back a result as expected.

Any ideas what I'm doing wrong ?

I'm using Microsoft Visual C++ Express Edition 2008 and either LV8.2.1 or 8.5

0 Kudos
Message 1 of 6
(2,415 Views)
0 Kudos
Message 2 of 6
(2,408 Views)
0 Kudos
Message 3 of 6
(2,406 Views)
Please post your project. Looking for errors regarding library calls is difficult without source code.
0 Kudos
Message 4 of 6
(2,386 Views)

Many thanks for looking at this for me.

 

In trying to come up with a isolating case, I discovered that the problem was that I wasn't copying the /data directory out of the /builds  and into the place where c++ was looking for it and so the dll was missing some vital support files.

0 Kudos
Message 5 of 6
(2,372 Views)

So that's the reason why I wasn't able to reproduce your problem.

It may sound strange but thank you for figuring out that a DLL lacking support files may fail silently.

I use DLLs quite often so I'm sure I'd have stumbled upon the problem someday. Smiley Happy

 

0 Kudos
Message 6 of 6
(2,366 Views)