MacOS and *OS Internals - Code Snippets
More Coming soon.
Note on compiling for iOS: I use the following shell script and call it "gcc-iphone":

export SDKROOT=/Applications/
#XCODE_DEVELOPER_USR_PATH=/Developer   # don't really need this..

gcc -arch armv7 # or -arch arm64
   -framework IOKit -framework CoreFoundation \
   -F /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/$SDK/System/Library/Frameworks \ 
   -I /Developer/Platforms/iPhoneOS.platform/DeviceSupport/Latest/Symbols/usr/include  \
   -L /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/$SDK/usr/lib 
   -L /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/$SDK/usr/lib/system $*

It is straightforward to change the SDK version (you could put that in a variable). This makes it easier to compile from the command line or a Makefile, rather than mucking around with XCode projects..

Forum About the Book Notes News Code Samples Downloads Resources Get the book from Amazon dock