A
André Hänsel
Hi,
I am trying to use the vendor-supplied DLL for a K8055 interface board
in my application. The vendor provides the DLL (in a Visual Basic and
a C flavour), a .lib file and an .h-file that looks like this:
#ifdef __cplusplus
extern "C" {
#endif
#define FUNCTION __declspec(dllexport)
FUNCTION long __stdcall OpenDevice(long CardAddress);
FUNCTION __stdcall CloseDevice();
FUNCTION long __stdcall ReadAnalogChannel(long Channel);
....
Those files are available here: http://www.velleman.be/ot/en/download/files/#24
Here's what I've done:
I changed the __declspec(dllexport) to __declspec(dllimport). There
was a function defined as bool, I changed it to int.
Then I included the .h-file and called the funtion.
#include "K8055D_C.h"
main()
{
long retval = OpenDevice(0);
return 0;
}
I used the following command line to build the program:
d:\MinGW\bin\gcc -c test.c
d:\MinGW\bin\gcc -o test.exe test.c K8055D_C.DLL
I get this error:
ccCG0kpK.o:test.c.text+0x32): undefined reference to
`_imp__OpenDevice'
collect2: ld returned 1 exit status
What was my mistake?
Regards,
André
I am trying to use the vendor-supplied DLL for a K8055 interface board
in my application. The vendor provides the DLL (in a Visual Basic and
a C flavour), a .lib file and an .h-file that looks like this:
#ifdef __cplusplus
extern "C" {
#endif
#define FUNCTION __declspec(dllexport)
FUNCTION long __stdcall OpenDevice(long CardAddress);
FUNCTION __stdcall CloseDevice();
FUNCTION long __stdcall ReadAnalogChannel(long Channel);
....
Those files are available here: http://www.velleman.be/ot/en/download/files/#24
Here's what I've done:
I changed the __declspec(dllexport) to __declspec(dllimport). There
was a function defined as bool, I changed it to int.
Then I included the .h-file and called the funtion.
#include "K8055D_C.h"
main()
{
long retval = OpenDevice(0);
return 0;
}
I used the following command line to build the program:
d:\MinGW\bin\gcc -c test.c
d:\MinGW\bin\gcc -o test.exe test.c K8055D_C.DLL
I get this error:
ccCG0kpK.o:test.c.text+0x32): undefined reference to
`_imp__OpenDevice'
collect2: ld returned 1 exit status
What was my mistake?
Regards,
André