LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems usings "Calling Library Function Node" with DLL compiled by LabWindowsCVI

Solved!
Go to solution

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 

 

 

0 Kudos
Message 1 of 2
(2,479 Views)
Solution
Accepted by topic author Tom J

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

0 Kudos
Message 2 of 2
(2,447 Views)