When I was reading about the new 4.0.2 iOS update I wanted to know what hackers do or try doing with a buffer overflow, which after some wikipedia'ing got me interested in playing with malloc and thus creating my own "NSObject".
I am not actually planning to use this in any of my applications, its only for learning and playing around with objective-c.
And of course, as expected I encountered some problems which I couldn't solve myself.
for creating my object I do:
+ (id)create{ return malloc(sizeof(self)); }
and
- (void)free { free(self); }
When calling [TestObject create]; I get the following console messages:
"8/11/10 11:17:31 PM TestingHeap[2675] * NSInvocation: warning: object 0x100002100 of class 'AObject' does not implement doesNotRecognizeSelector: -- abort"
So its trying to handle my object as an NSObject.. ? and how do I solve this.
Also when compiling without Foundation or AppKit, I get an error for missing symbols, __objc_empty_vtable and __objc_empty_cache in particular. I've tried including several header files from /usr/include/objc/
Thanks in advance.
Update
After linking with libobjc I receive EXC_BAD_INSTRUCTION when trying to call a method from my class.