Last active
March 7, 2017 18:24
-
-
Save JensAyton/376a37d6555d21f9a1506e7b4feaa166 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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