@thomthom said:
Wait, are you making a C++ extension instead of C?
Yes. I have finally made it. What a nightmare 
Xcode
New Project
Template > "Command Line Tool"!
Enter product name "SX_HelloWorld.bundle"
Type "C++"
The *.c file renamed to *.cpp.
Init_SX_HelloWorld( void ) has to be enclosed in extern "C"
extern "C" {
// The init function here
}
The last line of the code should read:
rb_define_module_function( mSUExtTest, "knock_knock", RUBY_METHOD_FUNC(rb_knock), 0 );
Now the important thing
Build Settings\Linking\Other Linker Flags > -dynamic -bundle -undefined suppress -flat_namespace
Build Settings\Search Paths\Header Search Path > has to point to Ruby headers
Build Settings\Search Paths\Library Search Path > has to point to Ruby compiled library
I have compiled the extension with LLVM GCC 4.2