plblocks


Block-capable Toolchain/Runtime for Mac OS X 10.5 and iPhone OS 2.2+

Introduction

Plausible Blocks (PLBlocks) provides a drop-in runtime and toolchain for using blocks in iPhone 2.2+ and Mac OS X 10.5 applications. Both the runtime and compiler patches are direct backports from Apple's Snow Leopard source releases.

The Plausible Blocks runtime makes use of custom, prefixed symbol names to avoid any binary conflicts when Apple adds block support to iPhone OS, or when running your binaries on Mac OS X 10.6.

The provided compilers are based directly on the Apple standard, stable compiler versions as shipped with the Mac OS X and iPhone SDKs. The runtime is based on Apple's original implementation donated to the LLVM project.

PLBlocks is provided by http://www.plausiblelabs.com'>Plausible Labs.

Supported Architectures

Hosts
  • Mac OS X 10.6 (i386, x86-64)
Targets
  • Mac OS X 10.5 (ppc, i386, x86-64)
  • iPhoneOS 3.0 and later (armv6, armv7) (including iPad)
  • iPhoneSimulator 3.0 and later (i386)
Languages
  • Objective-C (no garbage collection)
  • C, C++, and Objective-C garbage collection support are available in the 1.1-beta4 release.

If you're interested in supporting additional platforms (Linux, Windows, etc.) please feel free to join the development mailing list

Xcode 4.2 is not currently supported, as Apple is no longer shipping GCC.

Download

Compiler Download

Download the Compiler SDK to build a project that uses PLBlocks.

Runtime Download

Download the runtime to include PLBlocks in your own project.

While the 1.0 runtime is still supported, use of new features (garbage collection, C/C++ support) requires a PLBlocks 1.1+ runtime.

Installation & Use

Plausible Blocks is composed of two pieces:

  • Plausible Blocks SDK: Supplies custom compilers for use in Xcode.
  • PLBlocks Runtime: A runtime library required by all applications making use of Plausible Blocks.

To install the SDK, simply install the included “Plausible Blocks SDK” package. Once installed, an additional “GCC 4.2 (Plausible Blocks)” compiler will be available for selection in your Xcode project and targets. To build with the new compiler, simply select in either your project’s build settings, or on a per-target basis:

http://plblocks.googlecode.com/svn/wiki/images/plblocks-select-compiler.png

In addition to the SDK, you’ll need to include the PLBlocks runtime framework in your application. It is provided as an embeddable framework for Mac OS X, and as a static framework for iPhone applications.

To include in your project:

  1. Copy the Mac OS X or iPhone PLBlocks.framework to your project directory
  2. Within Xcode, select “Add -> Existing frameworks” and add the copied PLBlocks.framework to your project.
  3. Ensure that PLBlocks.framework has been added to your targets “Link Binary With Libraries” section.
  4. (Mac OS X Only) Add a new “Copy Files” build phase to copy PLBlocks.framework to your application’s “Framework” directory.
  5. Set the project, or a specific target, to use the “GCC 4.2 (Plausible Blocks)” compiler.

Additional Resources

If you'd like to read more about using blocks in your own software, we recommend:

  • Joachim Bengtsson's Programming with C Blocks
  • Mike Ash's Series on Blocks and PLBlocks (Part 1 and Part 2)

Building

To build PLBlocks, select one of the following targets:
  • Disk Image: Builds entire project and generates a distribution DMG.
  • Package SDK: Builds SDK package, including all compilers, and Xcode plugins
  • Runtimes: Builds all runtimes

The project should build on Mac OS X 10.5 and 10.6. In addition to Xcode 3.1.3 or 3.2, the iPhone 3.0 SDK is required.

Building the full SDK, including compilers, may take an extraordinarily long time. Unless you are experimenting with the compiler toolchain — or you are the type to enjoy watching paint dry — building only the Runtime targets during development is highly recommended.

Contributing

Please feel free to join the development mailing list. We're happy to accept patches to support additional platforms (eg, Linux) and compilers (such as LLVM/clang).

Please also consider donating to support this and future open source development: Donate via Paypal

Project Information

Labels:
C Objective-C GCC iPhone MacOSX Blocks