swift - Create CString from NSData -
swift - Create CString from NSData -
i have c api takes pointer arbitrary binary info function signatures following:
void receivedata(const char *data, size_t length); the bridging header imports swift next definition:
func receivedata(data: cstring, length: uint) i sense i'm missing basic, can't seem work out how cstring arbitrary nsdata - options seem conversion nsstring or string literal. how create cstring?
it create more sense able pass through cconstpointer<cchar>, compiler isn't having bar of - there way modify swift signature generated bridging header?
edit: cstring removed in xcode 6 beta 4. release notes:
the cstring type has been removed. values of type const char * imported constunsafepointer instead of cstring. c macros expand string literals imported string.
a c string null-terminated. arbitrary binary info doesn't need null terminated. think problem bridging mechanism sees char * , thinks "c string". perhaps if changed void *, more appropriate type in swift.
swift nsdata
Comments
Post a Comment