Skip to content

Instantly share code, notes, and snippets.

@JensAyton
Last active March 7, 2017 18:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JensAyton/376a37d6555d21f9a1506e7b4feaa166 to your computer and use it in GitHub Desktop.
Save JensAyton/376a37d6555d21f9a1506e7b4feaa166 to your computer and use it in GitHub Desktop.
extern "C" {
// This is global, but you can call it what you like
inline void MyPrefixedCFShow(const void *object) {
// Redeclared system function is local scope and counts as extern "C"
extern void CFShow(const void * object);
CFShow(object);
}
}
class DumbThing {
public:
static void wibble(const void *obj) {
// We can call MyPrefixedCFShow() here, but not CFShow()
MyPrefixedCFShow(obj);
}
};
// Include header with official declaration; fine because it matches
#include <CoreFoundation/CoreFoundation.h>
int main(int argc, const char * argv[]) {
DumbThing::wibble(CFSTR("Hello, World!"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment