LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

function not found - building my first dll

Hi All
 
I am trying to build my first dll in CVI which i want to call from within LabVIEW.  The dll is shown below.  (please forgive the c etiquette i am new to this).
 
/* Call Library source file */
#include "extcode.h"
__declspec(dllexport) void Interp(short CP1[3], short CP2[3], short CP3[3], short CP4[3], short X,
 short Y, short P[3], short PA[3], short PB[3]);
__declspec(dllexport) void Interp(short CP1[3], short CP2[3], short CP3[3], short CP4[3], short X,
 short Y, short P[3], short PA[3], short PB[3])
 {
    X = 15;
   
   PA[0] = X;   //X is IP for the desired extrapolated Z point
   PA[2] = CP1[2] + ((PA[0] - CP1[0])/(CP2[0] - CP1[0]))*(CP2[2] - CP1[2]);
   PA[1] = CP1[1];
   
   PB[0] = X;
   PB[2] = CP3[2] + ((PB[0] - CP3[0])/(CP4[0] - CP3[0]))*(CP4[2] - CP3[2]);
   PB[1] = CP3[1];
   
   P[0] = PA[0];
   P[1] = PA[1];
   P[2] = PA[2];
  }
 
The error message i get when i try to call this dll from LabVIEW is -
 
"The function name specified for this node cannot be found in the library. Right-click the Call Library Function node and select Configure, then choose the correct function name."
 
I have checked all my connections to the code interface node and all the setting of the dll being called and the function name is identical to that in the source code(Interp).
 
Any help with this would be a relief!
 
Thanks in advance
 
Craig
LabVIEW 2012
0 Kudos
Message 1 of 5
(3,892 Views)
Just a thought...
 
Follow the menu Build->Target Settings->Change to another set of options; here you can either select an include file (if you have one) as the definition of your function names to export, or select "Symbols Marked for Export" on the "Export What" drop-down.
 
JR
0 Kudos
Message 2 of 5
(3,884 Views)
Thanks Jr,
 
This looks promising.  I went into the options and included the "extcode.h" file under the "Export What" drop down box.
 
I went to re-compile (OK) and then re-build the project.  A dialog box with loads of warnings stating that varios functions found in extcode.h were not found in the source file and will therefore not be exported.  I continued with the build and ran it in LabVIEW but still the same error as before, although i think this is the right direction 🙂
 
Thanks again, any further help would be great.
 
Craig
LabVIEW 2012
0 Kudos
Message 3 of 5
(3,879 Views)
The header file to use there would be one containing your function prototypes only - depending on the size of your project and/or your programming style such a header file may not exist. Given the function definitions you posted, you might have more luck with the "Symbols Marked for Export" option selected.
 
JR
Message 4 of 5
(3,876 Views)

Thanks JR,

 

Problem solved 😉  I changed the Export what settings to both and it seems to work now (in LabVIEW at least - i think my c code needs working on).

You hit the nail on the Head

 

Regards, and have a good weekend.

Craig

LabVIEW 2012
0 Kudos
Message 5 of 5
(3,872 Views)