The usual way to declare an interface from an external DLL in C is to open its interface in the .H header file. Then, in order to access the DLL from C, the .H header file must be #include d in the C source code.
Translated into Delphi terms, you need to create a single file that describes the same interface in terms of pascal, translating the c syntax into pascal.
In your case, you will create a file, for example ...
unit xyzDevice; { XYZ device Delphi interface unit translated from xyz.h by xxxxx -- Copyright (c) 2009 xxxxx Delphi API to libXYZ - The Free XYZ device library --- Copyright (C) 2006 yyyyy } interface type TXyzDeviceType = integer; const xyzDll = 'xyz.dll'; XYZ_DEVICE_PCI = 1; XYZ_DEVICE_USB = 2; function XyzDeviceStatus ( kind : TXyzDeviceType ) : integer; stdcall; external xyzDLL; name 'DeviceStatus'; implementation end.
And you declare it in the uses your source code. And call the function as follows:
uses xyzDevice; ... case XyzDeviceStatus(XYZ_DEVICE_USB) of ...
source share