Conversion plug-ins to Mach-O binary format for Mac OS

This document describes the process for moving your PEF based Photoshop plug-in to Mach-O binary format.

For more information on this topic, please see the documentation found on the Apple web site: http://developer.apple.com

Requirements

The required development environment for this conversion is Metrowerks CodeWarrior (CW) 9.2. http://www.metroworks.com

You will also need the Apple OS X SDK installed. http://www.apple.com

The first step is auto converting your current project to the CW 9.2 project format. This is done by opening your project in CW 9.2 and responding 'Convert' to the convert dialog box that appears.

Change Your Project Settings

  1. In the Target > Target Settings panel change the Linker to “Mac OS X PowerPC Mach-O”

MachOConversion_img_0.jpg

  1. In the Target > Access Paths panel add “/usr/lib” into the System Paths list. ( You will need the Apple OS X SDK installed. )

MachOConversion_img_1.jpg

  1. In the Target > PPC Mac OS X Target panel change the Project Type to “Bundle Package”. Set the Creator to 8BIM and the Type to 8BFM ( filter ).

MachOConversion_img_2.jpg

  1. In the Language Settings > C/C++ Language panel check the following items.

MachOConversion_img_3.jpg

  1. The C/C++ Warnings panel can be adjusted as you like. Here are the settings that I have:

MachOConversion_img_4.jpg

  1. In the Linker > PPC Mac OS X Linker, select "Use pragma" for the Export Symbols option. Add “_PluginMain” to the Main Entry Point box. Check the other items as shown:

MachOConversion_img_5.jpg

  1. The SDK also includes multiple header files to help with your plug-in configuration. These are found in samplecode/common/includes:

    PIMachODebug.h, PIMachORelease.h, PIPEFDebug.h, PIPEFRelease.h, PIRezMachO.h, PIRezPEF.h

  1. Click the “Save” button and close the dialog.

Modify your PiPL selector

The new CodeMachOPowerPC PiPL entry must be added to your PiPL resource. Here is the Dissolve sample:

    #ifdef __PIWin__
        CodeWin32X86 { "PluginMain" },
    #else
        #ifdef BUILDING_FOR_MACH
            CodeMachOPowerPC { 0, 0, "PluginMain" },
        #else
            CodeCarbonPowerPC { 0, 0, "" },
        #endif
    #endif

Libraries for Mach-O

PEF required the following system libraries. Remove them.

MSL_C_Carbon.lib MSL_C++_Carbon.lib MSL_Runtime_PPC.Lib CarbonLib console.stubs.c

Mach-O uses the following libraries. Add these:

Frameworks for Mach-O

Select the Frameworks tab. Right click in the window and select “Add files...” Navigate to “System/Library/Frameworks” and add the “Carbon.framework” and “System.framework”.

Compile, Link and Test