Swift fail to detect constant in Macro from C header

In my C header, I have macro to define some constants:

typedef struct ion_type *ION_TYPE;
#define ION_TYPE_INT(x) ((intptr_t) (x))

#define tid_BOOL ((ION_TYPE) tid_BOOL_INT)
#define tid_INT ((ION_TYPE) tid_INT_INT)

#define tid_BOOL_INT 0x100
#define tid_INT_INT 0x200

I tried to import tid_BOOL in Swift file but it can't work. However, tid_BOOL_INT still can be imported successfully.

I guess the type casting for constant make weird things happen. Is there any suggestion in this situation?

Complex macros aren't imported into Swift.

Ohh I see. That makes sense now. Thanks for your info!

Terms of Service

Privacy Policy

Cookie Policy