Examples of creating Obj-C objects?

Hi. Does anyone have examples of LLVM assembler to create Objective-C objects and send messages? I'm talking about having an Engine hosted within my Objective-C app, and having LLVM bitcode call back into the app.


Which Objective-C runtime are you looking at? Clang currently supports the two Apple ABIs, the GCC and the GNUstep runtime. Take a look in CGObjCGNU.cpp and CGObjCMac.cpp.

If you're only interested in JIT compiling, then I would suggest that you look at the runtime's public API, and just use objc_msgSend() and friends to create objects. If you want to create classes, then use objc_createClassPair() and associated functions - you can do this outside of LLVM to create the class skeletons and then JIT-compile the methods with LLVM and attach them to the class, which will mean that your code is portable to all Objective-C implementations.