From J Wiki
Jump to: navigation, search

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

Wm yes check.png
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

Wm yes check.png
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.


  • 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

Contributed by Oleg Kobchenko