Interfaces/Xcode
These procedures show some ways to include J library in applications created with Xcode, an IDE for Mac OS X. They are the same regardless of application type: command-line tool, Cocoa, etc.
Using J dynamic library with Xcode
This project can be opened directly in Xcode and built. The j.h header can be used to add to other projects.
The goal is to use J library automatically without manually loading and assigning each function from library symbols.
Procedure (as shown, right)
- Create a Project in Xcode
- In the top section
- Add J header j.h under Headers (check [X] Copy)
- Add libj601.dylib in new Libraries Group (no Copy)
- See if library is added under Link Binary With Libraries in target
- In Project Settings, General tab, set Cross-Develop to Current
(required for library to be found)
- Make sure that Architecture in Project and Target settings
matches libj601. Set to "ppc" if necessary
The resulting executable can automatically pick up libj601.dylib from /usr/lib or from $DYLD_LIBRARY_PATH or from current working folder (not necessarily the application folder).
Universal Binary with Separate Libraries
This is a binary application ready to run. Selective can may be provided upon request.
J library libj601.dylib has separate versions for ppc and i386 architectures. So it is tempting to create two separate client applications. However, it is still possible to create universal binary with a simple Xcode Target setting.
Procedure
- Place the two libraries in folders ../libj601/i386 and ../libj601/ppc relative to the project folder.
- Add one of the libraries to Link with Binary group under Target
- In Target Settings, Build tab
- select Search Paths
- on Library Search Paths, press Edit button
- for J library, replace the last folder in path with $(arch), e.g. $(SRCROOT)/../libj601/$(arch)
- In Project Settings, General tab, set Cross-Develop to 10.4 (Universal)
- Architecture in Project and Target settings now can be set to both PowerPC and Intel.
(However for development only, native makes sense, to speed up the build.)
See Also
- Interfaces/JTask, a simple client/server Mac application; alternative run-time loading of J library
- User:Oleg Kobchenko/Nut Shell, shell and command-line tools
Contributed by Oleg Kobchenko