05-14-2009 12:22 PM
I'm trying to call a simple C routine from a VI using the Call Library Function Node. The ANSIdouble.vi example found inside the Call DLL.VI example given in the help files does work.
But when I substitute same program (the source code is given in the Call DLL.VI) compiled by LabWindowsCVI, it doesn't run. In fact it crashes Labview.
I'm using LV 8.2.1.
Furthermore, LabWindowsCVI doesn't compile the example code as written. I had to change the _declspec(dllexport) void declaration in front of the function to void DLLEXPORT DLLSTDCALL and #incude the file "C:\Program Files\National Instruments\CVI81\include\cvidef.h". The compiler produces ERRORs otherwise.
The program from Call DLL.VI is:
#include "extcode.h"
_declspec(dllexport) void ANSIdouble(double input, double *output);
_declspec(dllexport) void ANSIdouble(double input, double *output)
{
*output = input * input;
}
The program compiled by LabWindowCVI is:
#include "C:\Program Files\National Instruments\LabVIEW 8.2\cintools\extcode.h"
#include "C:\Program Files\National Instruments\CVI81\include\cvidef.h"
#include "TestC.h"
void DLLEXPORT DLLSTDCALL ANSIdouble(double input, double *output)
{
*output = input * input;
}
where TestC.h is the declaration:
void DLLEXPORT DLLSTDCALL ANSIdouble(double input, double *output);
The program was compiled into a debuggable DLL, with Target Setting box copied as an attachment.
Thanks to anyone who can help.
TJ
Solved! Go to Solution.
05-19-2009 07:00 AM
Solved it with a call to Al on the help line.
The correct procedure can be found by searching for "creating DLL" on the NI website.
The help page found by searching for "creating DLL" within CVI Help, is UTTERLY WRONG! At least with my ver 8.1.1.
Tom J