![]() |
Adobe Photoshop SDK |
|
Making a 64 bit Macintosh plug-in for PhotoshopThis page describes the process for creating a 64 bit Macintosh plug-in for Photoshop.Here is a list of the items needed to build and test a 64 bit Macintosh plug-in. This documentation will focus on updating the Dissolve filter example for 64 bit. All projects in the SDK have a 64 bit output option. Refer to the specific plug-in type for more information.
Step 1: Find portability issuesThe majority of the problems you will deal with when converting from 32 bit to 64 bit are assumptions made about the size of a pointer. There is a lot of code that puts a pointer ( 4 or 8 bytes ) into an int or long ( 4 bytes only ). As you can see, that will no longer work in the 64 bit environment. The second biggest problem is using the wrong type when getting the size of information. The new operator and many size operators return a size_t type ( 4 or 8 bytes ) and are assigned to int ( 4 byte ) values or long ( 4 or 8 bytes).
Step 2: Switch to the 10.5 SDK from AppleIt is recommended to use the 10.5 SDK from Apple. Switch to the 10.5 SDK by clicking on your Plug-in in the Targets section of your project. Select "Get Info" and then select the "Build" tab. Make sure that "Mac OS X 10.5" is selected in the Base SDK section.
![]() Step 3: Add 64 bit configurations to your projectSelect your main project and then "Get Info". Click on the configurations tab. Select your Debug target and then click the Dupulicate button at the bottom to clone this target to a new one. Use Debug_x86_64 as the new configuration name.
![]() Step 4: Change to 64 bit architecture for new configurationSwitch to the 64 bit architecture by clicking on your Plug-in in the Targets section of your project. Select "Get Info" and then select the "Build" tab. Make sure that "X86_64" is selected in the Architectures section.
![]() Step 3: Fix entry point and PiPLThe main entry point to the plug-in needs to be changed.
// -------------------------------------- // The old entrypoint // -------------------------------------- DLLExport MACPASCAL void PluginMain( const int16 selector, void * filterRecord, int32 * data, int16 * result) // -------------------------------------- // Thew new entrypoint // using the dynamic type intptr_t // -------------------------------------- DLLExport MACPASCAL void PluginMain( const int16 selector, void * filterRecord, intptr_t * data, int16 * result) The PiPL property needs a 64 bit selector. Here is the recommended PiPL properties for all platforms:
#ifdef __PIMac__ #if (defined(__x86_64__)) CodeMacIntel64 { "PluginMain" }, #endif #else #if defined(_WIN64) CodeWin64X86 { "PluginMain" }, #else CodeWin32X86 { "PluginMain" }, #endif #endif Step 4: TestAdobe Photoshop CS5 installs as a universal binary with i386 and x86_64 as the two binaries inside. Depending on your operating system the correct binary will launch. It is recommended to test on both a 64 bit operating system and a 32 bit operating system.Other IssuesOnly the Dissolve example has been converted to a Cocoa UI and all the projects noted above. All of the other examples have had their UI removed on the 64 bit Macintosh Platform. Use the Dissolve example to see how to hook up a UI on 64 bit Macintosh to a plug-in. All of the other plug-ins are default configured to make a Universal Binary for i386 and x86_64. Use the __LP64__ compile flag to determine that the target is 64 bit.Online InformationWatch out for Objective-C naming conflicts. Please use a unique id for all of your Objective-C code names as described here. See this for more information: Preventing Name ConflictsFinding the Version info in XcodeFrom the Xcode menu select About XcodeVersion 3.1.2 Component versions Xcode IDE: 1149.0 Xcode Core: 1148.0 ToolSupport: 1102.0 |