I'm writing some python code that calls a C dll via python's ctypes
module.
The DLL in question defines some return values as enum
s in it's header files:
//
// Device status
//
enum {
FT_OK,
FT_INVALID_HANDLE,
FT_DEVICE_NOT_FOUND,
FT_DEVICE_NOT_OPENED,
FT_IO_ERROR,
FT_INSUFFICIENT_RESOURCES,
FT_INVALID_PARAMETER,
<continued---snip>
};
I'm interfacing this from python, so I don't have native enums. Can I just assume that the contents of the enum start at a value of 0
, and increment by 1 for each item? That's easy enough to implement, but it seems like I'd then be relying on implementation details of the compiler.
I've done some digging about the internals of enum
variables, but I could not find much about how they work, internally. Only documentation on how to use them in C/C#/whatever.
I know if the enum
had constant definitions for the various variables, I could just rely on that, but in this case, I'm interfacing with external code which I don't have access to (just the dll).