Usage of Lib file causes linker error: "unresolved external..."
-
Hi,
I want to control a meter via LAN with a Borland C++ (BDS2006) program.
The manufacturer offers 4 files:* awglib.dll
* awglib.def
* lib.h
* lib.clib.c and lib.h are also used as source code for awglib.dll.
**********************************
Content of awglib.def:
**********************************
LIBRARY AWGLIBEXPORTS
AwgConnect @1
AwgDisconnect @2
AwgSend @3
AwgSendString @4
AwgReceive @5
AwgReceiveMessage @6
AwgReceiveBinary @7
AwgSendFile @8
AwgReceiveFile @9
********************************************************************
Content of lib.h:
**********************************
#ifndef _LIB_H_
#define _LIB_H_#ifdef WIN32
#include "windows.h"
#else /* not WIN32 /
#define APIENTRY
#endif / WIN32 */int APIENTRY AwgConnect(char *hostname);
void APIENTRY AwgDisconnect(int fd);
int APIENTRY AwgSend(int fd, char *s, int len);
int APIENTRY AwgSendString(int fd, char *s);
int APIENTRY AwgReceive(int fd, char *buf, int bufSize);
int APIENTRY AwgReceiveMessage(int fd, char *buf, int bufSize);
int APIENTRY AwgReceiveBinary(int fd, char *buf, int bufSize);
int APIENTRY AwgSendFile(int fd, char *localFilename, char *remoteFilename);
int APIENTRY AwgReceiveFile(int fd, char *remoteFilename, char *localFilename);#endif /* _LIB_H_ */
*****************************************I found a sample program which is written in MSVC++6.0.
To get a lib file I used implib.exe but after including the lib file to the project the linker error message "unresolved external.." appears.
Here you can see my source code:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop#include "AWG.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
#include "C:\Temp\lib.h"
TForm5 Form5;
//#pragma comment( lib, "c:\Temp\awglib.lib" )
//---------------------------------------------------------------------------
__fastcall TForm5::TForm5(TComponent Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm5::Button1Click(TObject *Sender)
{
char *p=NULL;
int fd;
AwgConnect(p);
}
//----------------------------------------------------------------------------I also tried to compile a new def with impdef and afterwards use that def file to create the lib file with implib -> still failing.
Do you have an idea what could be the root cause for that error?
Many thanks in advance.
Best regards,
Andreas