Calling a C function in a DLL with enum parameters from Delphi

Posted by dommer on Stack Overflow See other posts from Stack Overflow or by dommer
Published on 2010-04-15T07:05:54Z Indexed on 2010/04/15 7:13 UTC
Read the original article Hit count: 280

Filed under:
|
|

I have a third-party (Win32) DLL, written in C, that exposes the following interface:

DLL_EXPORT typedef enum
{
  DEVICE_PCI = 1,
  DEVICE_USB = 2
} DeviceType;

DLL_EXPORT int DeviceStatus(DeviceType kind);

I wish to call it from Delphi.

How do I get access to the DeviceType constants in my Delphi code? Or, if I should just use the values 1 and 2 directly, what Delphi type should I use for the "DeviceType kind" parameters? Integer? Word?

© Stack Overflow or respective owner

Related posts about delphi

Related posts about dll