I would like to constrain a generic to a type that can be represented in C. Is there a protocol or type in the Swift standard library that all C types conform to?
func doWithCType<T:CRepresentable>(cValue: T) {
// do thing with C type
}
If not a CRepresentable, maybe a CStruct type?
Clues:
Using this C type:
typedef struct {
int hodor;
} Hodor;
I force casted a struct to an incompatible type (causing a crash). This was the error message: Could not cast value of type '__C.Hodor' (0x1035c0700) to 'Swift.CVarArg' (0x107196240).
I can't find "__C" anywhere, but I'm hopeful that there's a distinction for the C types.