objc provides c-interfaces for basic interfaces and types ( #include <objc/headers_you_need.h> , so you can use these interfaces in pure c / C ++ TUs and then include libraries like Foundation or AppKit in mm and use objc types and messaging in the implementation.
the next one is a very simple interface that is not typical, but I recommend that you make it typeafe for the type of objc that you are wrapping. this should be enough to get started in the right direction.
// .hpp namespace MON { // could be an auto pointer or a dumb pointer; depending on your needs class t_MONSubclassWrapper { public: // usual stuff here... // example wrapper usage: void release(); private: id d_objcInstance; }; } /* << MON */ // .mm ... #include <Foundation/Foundation.h> MON::t_MONSubclassWrapper::t_MONSubclassWrapper() : d_objcInstance([[MONSubclass alloc] init]) { } ... void MON::t_MONSubclassWrapper::release() { [d_objcInstance release]; }
source share