Compiling & Linking Models
Setting up an XCode Project
XCode is Apple's development environment. It includes the GNU Objective-C, C and C++ compilers as well as the usual
IDE stuff (editor, debugger). It is included with Mac OSX, but is only installed if you specifically request it. You can
install it from the OS DVD-ROM or download the latest version from the Apple developer web-site (it's around 900Mbytes at the
moment (version 2.3) so maybe not something to try on a 56k dial-up modem). The XCode applicaion resides in
/Developer/Applications rather than the usual OSX applications directory
Launch XCode (/Developer/Applications/Xcode.app). It will not create a window initially. Create a new project using
File->New Project.... From the window select either
- BSD Dynamic Library for a model written in C with no GUI features
- Cocoa Dynamic Library for a model written in C/Objective-C with optional GUI features (e.g. alert panels)
- Carbon Dynamic Library for a model written in C with Carbon GUI features (I've never tried this though)
from the "Dynamic Library" section. Choose a location for the Project.
You will need to create a source file for the model (File->New File...). XCode will optionally create a header (.h) file
for you. You will also need to include the solv95.h file in the project
(Project->Add to Project.... Choose the file, click add and then select "Copy files if needed" option from the dialogue box).
Setting up your Model Files
You can now edit the model file. When you build the project, it will create a dylib file in the ./build/Debug directory. You can load this
into DDESolve. To allow debugging of your model, create a new custom executable in the project (Project->New Custom exectutable...).
Select the DDESolve application and click "Choose". Now edit the new executable: make sure the default directory is the directory where
your dynamic library resides, and add its full name as an argument of the executable. Now, when you run your library, it will be
automatically loaded into DDESolve and the DDESolve application will be run. You can set breakpoints in your model and step through it.
Back to index