07-05-2010 04:23 AM
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
07-05-2010 04:32 AM
07-05-2010 04:36 AM
07-05-2010 08:48 AM
07-05-2010 11:47 AM
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.
07-05-2010 12:52 PM
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.