P8055 USB board with Borland Turbo using 'C' can't connect

I’ve tried searching the internet as this probably is not a unique problem but can’t find anything as nobody seems to use C these days. I’m using a Vellerman 8055 USB board with Windows 10 (64) and Borland turbo C.

I can execute the samples.

I’ve placed the DLL’s in the system areas and in the source directory. The 8055.h file is local and in the include lib. a basic C program compiles but not when I include the header K8055D.h file.

The code:
#include <stdio.h>
#include “K8055D.h”
void main()
{
int intCardAddress = 0;
printf(“Hello you’ve started\n”);
OpenDevice(intCardAddress);
/ClearAllDigital();
SetDigitalChannel(2);
/
CloseDevice(intCardAddress);
}

The error:
ERROR: invalid argument for __declspec()
ERROR: syntax error before or at line 7 in file ‘C:\Ch/K8055D.h’
==>: __declspec(dllimport) long __stdcall OpenDevice(long CardAddress);
BUG: __declspec(dllimport)<== ???
ERROR: maybe missing ‘;’ before ‘OpenDevice’
ERROR: syntax error before or at line 7 in file ‘C:\Ch/K8055D.h’
==>: __declspec(dllimport) long __stdcall OpenDevice(long CardAddress);
BUG: __declspec(dllimport) long __stdcall OpenDevice<== ???
ERROR: missing ‘;’ before ‘)’
ERROR: syntax error before or at line 7 in file ‘C:\Ch/K8055D.h’
==>: __declspec(dllimport) long __stdcall OpenDevice(long CardAddress);
BUG: __declspec(dllimport) long __stdcall OpenDevice(long CardAddress)<== ???
ERROR: invalid argument for __declspec()
ERROR: syntax error before or at line 8 in file ‘C:\Ch/K8055D.h’
==>: __declspec(dllimport) __stdcall CloseDevice();
BUG: __declspec(dllimport)<== ???
ERROR: missing ‘;’ before ‘CloseDevice’
ERROR: syntax error before or at line 8 in file ‘C:\Ch/K8055D.h’
==>: __declspec(dllimport) __stdcall CloseDevice();
BUG: __declspec(dllimport) __stdcall CloseDevice<== ???
ERROR: invalid argument for __declspec()
ERROR: syntax error before or at line 9 in file ‘C:\Ch/K8055D.h’
==>: __declspec(dllimport) long __stdcall ReadAnalogChannel(long Channel);
BUG: __declspec(dllimport)<== ???
ERROR: identifier ‘__stdcall’ redeclared
ERROR: syntax error before or at line 9 in file ‘C:\Ch/K8055D.h’
==>: __declspec(dllimport) long __stdcall ReadAnalogChannel(long Channel);
BUG: __declspec(dllimport) long __stdcall<== ???
ERROR: with unnecessary identifier ‘Channel’ in casting operator
ERROR: incompatible types for casting operation, casting void to int
ERROR: argument 1 of the function is undefined or not a valid expression
ERROR: syntax error before or at line 9 in file ‘C:\Ch/K8055D.h’
==>: __declspec(dllimport) long __stdcall ReadAnalogChannel(long Channel);
BUG: __declspec(dllimport) long __stdcall ReadAnalogChannel(long Channel);<== ???
ERROR: in expansion of macro ‘FUNCTION’
ERROR: invalid argument for __declspec()
ERROR: syntax error before or at line 10 in file ‘C:\Ch/K8055D.h’
==>: __declspec(dllimport) __stdcall ReadAllAnalog(long *Data1, long *Data2);
BUG: __declspec(dllimport)<== ???
ERROR: missing ‘;’ before ‘ReadAllAnalog’
ERROR: syntax error before or at line 10 in file ‘C:\Ch/K8055D.h’
==>: __declspec(dllimport) __stdcall ReadAllAnalog(long *Data1, long *Data2);
BUG: __declspec(dllimport) __stdcall ReadAllAnalog<== ???
ERROR: cannot execute command ‘C:\Ch\Myversion.c’

Exit code: -1

How can I cure this please???

It seems that in the .h file you are using “long”, e.g OpenDevice(long CardAddress);
Should it be “int” instead, as in the code:
int intCardAddress = 0;
printf(“Hello you’ve started\n”);
OpenDevice(intCardAddress);
?

Can you use this original K8055D.h:

[code]#ifdef __cplusplus
extern “C” {
#endif

#define FUNCTION __declspec(dllimport)

FUNCTION int __stdcall OpenDevice(int CardAddress);
FUNCTION void __stdcall CloseDevice();
FUNCTION int __stdcall ReadAnalogChannel(int Channel);
FUNCTION void __stdcall ReadAllAnalog(int *Data1, int *Data2);
FUNCTION void __stdcall OutputAnalogChannel(int Channel, int Data);
FUNCTION void __stdcall OutputAllAnalog(int Data1, int Data2);
FUNCTION void __stdcall ClearAnalogChannel(int Channel);
FUNCTION void __stdcall ClearAllAnalog();
FUNCTION void __stdcall SetAnalogChannel(int Channel);
FUNCTION void __stdcall SetAllAnalog();
FUNCTION void __stdcall WriteAllDigital(int Data);
FUNCTION void __stdcall ClearDigitalChannel(int Channel);
FUNCTION void __stdcall ClearAllDigital();
FUNCTION void __stdcall SetDigitalChannel(int Channel);
FUNCTION void __stdcall SetAllDigital();
FUNCTION bool __stdcall ReadDigitalChannel(int Channel);
FUNCTION int __stdcall ReadAllDigital();
FUNCTION int __stdcall ReadCounter(int CounterNr);
FUNCTION void __stdcall ResetCounter(int CounterNr);
FUNCTION void __stdcall SetCounterDebounceTime(int CounterNr, int DebounceTime);
FUNCTION int __stdcall Version();
FUNCTION int __stdcall SearchDevices();
FUNCTION int __stdcall SetCurrentDevice(int CardAddress);
FUNCTION int __stdcall ReadBackDigitalOut();
FUNCTION void __stdcall ReadBackAnalogOut(int *Buffer);

#ifdef __cplusplus
}
#endif[/code] ?

That didn’t work I’m afraid. I’ve changed all the 'long’s to 'int’s in the header file.

errors:

ch -n ./Myversion.c
ERROR: invalid argument for __declspec()
ERROR: syntax error before or at line 7 in file ‘C:\Ch/K8055D.h’
==>: __declspec(dllimport) int __stdcall OpenDevice(int CardAddress);
BUG: __declspec(dllimport)<== ???
ERROR: maybe missing ‘;’ before ‘OpenDevice’
ERROR: syntax error before or at line 7 in file ‘C:\Ch/K8055D.h’
==>: __declspec(dllimport) int __stdcall OpenDevice(int CardAddress);
BUG: __declspec(dllimport) int __stdcall OpenDevice<== ???
ERROR: missing ‘;’ before ‘)’
ERROR: syntax error before or at line 7 in file ‘C:\Ch/K8055D.h’
==>: __declspec(dllimport) int __stdcall OpenDevice(int CardAddress);
BUG: __declspec(dllimport) int __stdcall OpenDevice(int CardAddress)<== ???
ERROR: invalid argument for __declspec()
ERROR: syntax error before or at line 8 in file ‘C:\Ch/K8055D.h’
==>: __declspec(dllimport) __stdcall CloseDevice();
BUG: __declspec(dllimport)<== ???
ERROR: missing ‘;’ before ‘CloseDevice’
ERROR: syntax error before or at line 8 in file ‘C:\Ch/K8055D.h’
==>: __declspec(dllimport) __stdcall CloseDevice();
BUG: __declspec(dllimport) __stdcall CloseDevice<== ???
ERROR: invalid argument for __declspec()
ERROR: syntax error before or at line 9 in file ‘C:\Ch/K8055D.h’
==>: __declspec(dllimport) int __stdcall ReadAnalogChannel(int Channel);
BUG: __declspec(dllimport)<== ???
ERROR: identifier ‘__stdcall’ redeclared
ERROR: syntax error before or at line 9 in file ‘C:\Ch/K8055D.h’
==>: __declspec(dllimport) int __stdcall ReadAnalogChannel(int Channel);
BUG: __declspec(dllimport) int __stdcall<== ???
ERROR: with unnecessary identifier ‘Channel’ in casting operator
ERROR: incompatible types for casting operation, casting void to int
ERROR: argument 1 of the function is undefined or not a valid expression
ERROR: syntax error before or at line 9 in file ‘C:\Ch/K8055D.h’
==>: __declspec(dllimport) int __stdcall ReadAnalogChannel(int Channel);
BUG: __declspec(dllimport) int __stdcall ReadAnalogChannel(int Channel);<== ???
ERROR: in expansion of macro ‘FUNCTION’
ERROR: invalid argument for __declspec()
ERROR: syntax error before or at line 10 in file ‘C:\Ch/K8055D.h’
==>: __declspec(dllimport) __stdcall ReadAllAnalog(int *Data1, int *Data2);
BUG: __declspec(dllimport)<== ???
ERROR: missing ‘;’ before ‘ReadAllAnalog’
ERROR: syntax error before or at line 10 in file ‘C:\Ch/K8055D.h’
==>: __declspec(dllimport) __stdcall ReadAllAnalog(int *Data1, int *Data2);
BUG: __declspec(dllimport) __stdcall ReadAllAnalog<== ???
ERROR: cannot execute command ‘C:\Ch\Myversion.c’
Exit code: -1

Strange problem indeed.
You may try to use the Bloodshed Dev-C++ example project as a starting point…
It is located in the folder \Examples\K8055NDemoDevC

Moved to the appropriate forum (Velbus is only for the Velbus domotics system).