I tried this code:
// main.m
#import <stdio.h>
@interface Test
+ (void)test;
@end
@implementation Test
+ (void)test
{
printf("test");
}
@end
int main()
{
[Test test];
return 0;
}
with LLVM/Clang without any framework, it doesn't compiled with this error:
Undefined symbols:
"_objc_msgSend", referenced from:
_main in main.o
ld: symbol(s) not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
So I added libobjc.dylib
. Code compiled, but threw this runtime exception:
objc[13896]: Test: Does not recognize selector forward::
Program received signal: “EXC_BAD_INSTRUCTION”.
#0 0x9932a4b4 in _objc_error
#1 0x9932a4ea in __objc_error
#2 0x993212b6 in _objc_msgForward
#3 0x99321299 in _objc_msgForward
#4 0x99321510 in _class_initialize
#5 0x99328972 in prepareForMethodLookup
#6 0x99329c17 in lookUpMethod
#7 0x99321367 in _class_lookupMethodAndLoadCache
#8 0x99320f13 in objc_msgSend
#9 0x00001ee5 in start
I realized some implementation required for root class, but I don't know what should I do next. What's required to make a new root class? And is there any specification for this?