LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use DLL function to be made using Borand C++

I am trying to use DLL module to be generated using Borand C++.
 
The DLL and librabry is basically for controling hardware.  So, the company provided the DLL, Library source and source codes.
 
In header file, Function is defined like these.
 
extern "C" WINAPI __declspec(dllexport) int NmcInit(char *portname, unsigned int baudrate);
extern "C" WINAPI __declspec(dllexport) void InitVars(void);
extern "C" WINAPI __declspec(dllexport) BOOL NmcSendCmd(byte addr, byte cmd, char *datastr, byte n, byte stataddr);
extern "C" WINAPI __declspec(dllexport) void FixSioError(byte addr);
extern "C" WINAPI __declspec(dllexport) void NmcShutdown(void);
//Module type independant commands (supported by all module types)
extern "C" WINAPI __declspec(dllexport) BOOL NmcSetGroupAddr(byte addr, byte groupaddr, BOOL leader);
extern "C" WINAPI __declspec(dllexport) BOOL NmcDefineStatus(byte addr, byte statusitems);
extern "C" WINAPI __declspec(dllexport) BOOL NmcReadStatus(byte addr, byte statusitems);
extern "C" WINAPI __declspec(dllexport) BOOL NmcSynchOutput(byte groupaddr, byte leaderaddr);
 
So, To use thses DLL, I put the DLL and Library file into the project directory.
and then, I include the library file with add files.
and then, I made a header file to use DLL function.  In the hearder file, I defined fucntions like these
 

int DLLEXPORT NmcInit(char *portname, unsigned int baudrate);
void DLLEXPORT  InitVars(void);
BOOL DLLEXPORT NmcSendCmd(byte addr, byte cmd, char *datastr, byte n, byte stataddr);
void DLLEXPORT FixSioError(byte addr);
void DLLEXPORT NmcShutdown(void);
 
But, with these setting, when i used these fuctions, I received an error message like this
 
  Undefined symbol '_NmcInit' referenced in "server.c".
 
How to solve this problem? I don't really know this problem..
 
I need your help...
 
 
 
0 Kudos
Message 1 of 2
(4,132 Views)

Hello jay hwang,

You can try explicitly defining the calling convention in the header file, before each function:

int __cdecl DLLEXPORT NmcInit(char *portname, unsigned int baudrate); ...

Then you should make sure that your compatibility mode in CVI is set to Visual C/C++ under Options»Build Options»Compatibility with ...

Then you should make sure you #include the header file at the top of your source file.

 

Hope that helps.

Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 2 of 2
(4,108 Views)