-
Notifications
You must be signed in to change notification settings - Fork 8
JIT with mulle clang
JIT compilation should be easy, if you have the proper mulle-objc-runtime.h
header accessible. Your JIT code should import it, which it usually does by virtue of including Foundation.h
, MulleObjC.h
or some such header.
The resulting compiled object will contain a function __load_mulle_objc
that is an __attribute__(( constructor))
function, meaning that it should execute as soon as loaded.
Depending on the JIT setup you may have to call __load_mulle_objc
yourself, to get classes, categories, strings, selectors etc. added to the runtime.
The lldb debugger does some funky JIT stuff, as the mulle-objc-runtime.h
header is not readily available. To support such scenarios, your code must define a top level variable __mulle_objc_objccompilerinfo
like so:
static const
struct mulle_clang_objccompilerinfo
{
unsigned int load_version;
unsigned int runtime_version;
} __mulle_objc_objccompilerinfo =
{
12, // load version must match!
// check with: mulle-clang --version
0 // 0 to not emit __load_mulle_objc
// otherwise provide the current runtime version
// as: ((0 << 20) | (13 << 8) | 1) for 0.13.1
};