Using TurboActivate on Mac OS X
TurboActivate runs natively on Mac OS X and you can use it from any programming language. This article will show you some tips and tricks specific to Mac OS X. You should use this article alongside one of the following:
- Using TurboActivate with Adobe AIR
- Using TurboActivate with C, C++, & Objective-C
- Using TurboActivate with Java
- Using TurboActivate with Real Studio (Real Basic)
Before you can do anything you need to login to your LimeLM account (or sign up) and download the TurboActivate-Mac.zip. This zip contains the libTurboActivate.dylib along with source code examples.
"TurboActivate.dat" location
TurboActivate loads the "TurboActivate.dat" file from the same directory as the executable. If you want to load the "TurboActivate.dat" file from a directory other than the one the executable's path, then use the PDetsFromPath() function.
Adding "libTurboActivate" to your application bundle
If you're making a C, C++, or Objective-C app then you need to make sure your application can find the "libTurboActivate.dylib" file at runtime. In Xcode you can do this by setting the "Runpath Search Paths" project setting:
Use the "@executable_path" variable to load "libTurboActivate.dylib" relative to your app's binary. For instance, if "libTurboActivate.dylib" will be in the same path as your binary then you should set "Runpath Search Paths" to the following:
@executable_path/.
If you want "libTurboActivate.dylib" to be in the "Frameworks" directory of your app bundle, then you can set "Runpath Search Paths" to:
@executable_path/../Frameworks
Other commandline compilers
If you're building your app from commandline use the -rpath linker option. For instance, if you want to load libTurboActivate.dylib from your app's executable path, then the compiler options will look something like the following:
cc -o main ... -Wl,-rpath,@executable_path/.
If you want the *.dylib to be in the "Frameworks" directory in your *.app bundle, then the compiler options will look something like this:
cc -o main ... -Wl,-rpath,@executable_path/../Frameworks
Getting the version number of libTurboActivate.dylib
The version number is embedded in the *.dylib file. You can get it in human readable form by typing the following line in Terminal:
otool -L libTurboActivate.dylib
The output will be several lines long. The version number is on the second line before the closing parentheses. For example:
libTurboActivate.dylib:
@rpath/libTurboActivate.dylib (compatibility version 1.0.0, current version 2.11.0)
...
Reducing the size of libTurboActivate.dylib
The TurboActivate library "libTurboActivate.dylib" is built as a universal library; it works on Intel Macs (x86 and x64) and PPC Macs. You can use the lipo commandline tool to remove support for platforms you don't need. For example, if you want to remove PPC support:
lipo -remove ppc7400 libTurboActivate.dylib -output libTurboActivate-noPPC.dylib
Then create a backup of the old "libTurboActivate" and replace it with the new PPC-less "libTurboActivate":
mv libTurboActivate.dylib libTurboActivate-all.dylib mv libTurboActivate-noPPC.dylib libTurboActivate.dylib
