search
    
MacOS and *OS Internals - Code Snippets
Note on compiling for iOS: I use the following shell script and call it "gcc-iphone":
# Do yourselves a favor and create a symlink to the mile long path of the SDK. Mine is:
#
# ls -l /iOSDeveloper
# lrwxr-xr-x  1 root  wheel  80 Mar 30 16:15 /iOSDeveloper ->
#   /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
#
# If SIP won't let you do that, create in your own home dir as ~/iOSDeveloper. 
# Makes life so much easier.

SDK=iPhoneOS.sdk
export XCODE_DEVELOPER_USR_PATH="/Developer"
export SDKROOT="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk"

# No longer needed : -sdk iphoneos gcc -arch arm64 -d__arm64__ \
# If you want to change this to armv7, just replace "arm64" below with armv7

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 \
 -D__arm64__ \
 -DARM \
  $*


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