For some reason the following code causes a SIGSEGV when I try to call CFShow_New:
The typedef:
typedef void* (*CFShow_XX)(CFTypeRef lol);
The actual code:
ImageLoaderMachO* loader =
dyld::getDyldImage("/XXX/CoreFoundation");
Symbol cfshow_sym = loader->findSymbol("_CFShow");
CFShow_XX* CFShow_New = (CFShow_XX*)cfshow_sym.nl.n_value;
assert(cfshow_sym.nl.n_value == (uint32_t)CFShow);
CFStringRef str = CFSTR("Test123");
CFShow(str); /* Works */
(*CFShow_New)(str); /* SIGSEGV's */
What could be the issue? CFShow is an extern "C", could that cause it? And if so, how do I fix it?
You defined the pointer to pointer to function do this:
and call: