REALBasic Plug-ins: Targeting New Platforms
This document assumes you have a plugin which works under classic MacOS (i.e. before Mac OS X), and you'd like to make it also work for Carbon (OS X) or Windows. Below is a general outline of the steps you'll need to take.
Targeting Carbon
- Create a new target in your CodeWarrior project, cloned from the MacOS PPC target. Make it the current target.
- Add CarbonLib to this target, and remove other libraries except for MSL RuntimePPC.Lib.
- Go into the target settings, and make the following changes:
- Change your System Access Paths to point to the location of your Carbon Support folder, rather than the usual MacOS Support folder. You may also need the Runtime PPC folder. But the details here are likely to change depending on the version of CodeWarrior and Carbon SDK you're using.
- Under PPC Target, change the ResType field to PLCN, and change the Header Type pop-up to None. Also, changing the File Name to something that won't conflict with the PPC (classic) output file.
- Under C/C++ Language change the prefix file to CarbonHeaders.h.
- Build. If your code is doing anything not Carbon-compliant, the compiler will usually let you know.
There are a lot of things you can't do in Carbon code, most of them related to accessing MacOS toolbox structures. If your code relied entirely on REALbasic API functions, you may not have to change much; but if you use Mac OS toolbox calls, you may need to make some changes. See Apple's Carbon Specification for the latest Carbon compatibility info.
You can test your Carbonized plugin by either running it with the Carbon version of the REALbasic IDE (either in OS 9 or OS X), or by using that IDE to build a Carbon application.
Targeting Windows
- Create a new target in your CodeWarrior project, cloned from one of the Mac ones. Make it the current target.
- Go into the target settings, and make the following changes:
- Under Target Settings change the Linker to Win32 x86 Linker. Also set the Postlinker to RB DLL PostLinker, if you have that installed.
- Remove Mac libraries from your Win32 target. Also remove any resource files.
- Change your System Access Paths to point to the Win32-x86 Support folder, rather than the MacOS Support folder. You may also need the MSL_Win32 and MSL_X86 folders.
- Under X86 Target, change the Project pop-up to Dynamic Link Library (DLL), and set the File Name to something sensible like "temp.DLL".
- Under RB DLL PostLinker, set the name of the output file to something sensible like "plugin.Win32". Leave the Resource ID set to 128.
- Under C/C++ Language change the prefix file to winheader.h.
- Add the Windows libraries to your Win32 target. There are several needed; the easiest approach is to drag them directly from another project (such as the BoxControl example included with the SDK).
- Build. If your code is using any Mac-isms, these will of course need to be changed into the corresponding Windows-isms.
targets.html
1 Jun 2000