MacOS X

This page details building assembly language and C Carbon and MacOS X applications with LIDE 3. Before beginning download this small self extracting archive containing a new linker and example projects. After Unstuffing the archive place the new linker 'LinkPPC PEF Carbon' in your Anvil Tools folder and the new project setup 'MrC Carbon - X' in Anvil Project Setups.

 

Fantasm

Making Carbon Apps with Fantasm

 

THE LINKER

The first thing you need is the new LINKER. This is a Fantasm Carbon Linker that links with CarbonLib rather than InterfaceLib and produces PEF fragments that can run under both MacOS 9 and MacOS X. (It can actually run on anything as old as MacOS 8.1 if you have CarbonLib in your extensions folder).

You need to put the linker in your Anvil Tools folder.

There are some things you should be aware of:

1. It is not necessary to replace the other PEF Linker. This has a different type, so when you either select Open Project or Edit project from the project menu in Anvil you will be able to select it as a linker from the Build Process pane on the left hand side.

2. This revision of the new linker is in ALPHA test. That means it hasn't yet made Beta (external test), Release Candidate (nearly released), Gold Master (about to be released), or Released status. As with all test software, please back up all your data, and treat it with care. Let us know if you get any unusual behavour.

3. No test linking is provided to the any shared libraries due to constraints with the current configuration. This may cause problems if you mis-spell or get a bad import name.

4. You cannot include any shared libraries in your project currently. Only the routines in Carbon Lib will be available. As this is most of the operating system, this is not too much of a hardship.

 

A SAMPLE APP

Here is a sample app you can play with.

1. This sample app has no menus or event handling - it's for demo puposes only.

2. We've tested the app on Mac OS 9, and Mac OS X. It is, however, a very, very simple application, and doesn't really support what you need in a real world application. The actual OS stuff in our application is simple enough to comprehend quickly, and get you going straight away.

 

C

Making Carbon Apps in C with LIDE 3

BasicApp

Here is a sample C application you can play with. This is the same application as supplied in the Carbon SDK. The only change we've made is to add Sound.h to the list of includes so it will actually compile :)

Note that when you open the project with Anvil for the first time it will ask you two questions.

1. Where is the target of the project? Use the file selector to move to the 'C-BasicApp' folder and select BasicApp.

2. Where is CarbonLib? Use the file selector to move to your LIDE 3:MPW:Libraries:StubLibraries folder and select CarbonLib. You must always link to the stub library and not the real CarbonLib library.

Finally, please note you will need the headers from the Carbon SDK. This sould be placed in your Lide3:MPW:Interfaces:CIncludes folder.

 

 

 

HINTS ON PRODUCING YOUR OWN APPLICATION

1. Read Carbon Porting.pdf and Carbon 1.0.4 Release Notes.pdf (or later) from the CarbonLib SDK, available off the apple website <http://developer.apple.com>.

2. In assm you may need to import any names not in our headers. Just type import function_name on a seperate line.

3. In the SIZE resource configuration in the project setup select Accept Suspend Events (as per the Carbon docs), and also Does activate on FG Switch (as per Anvil Docs). If you do not do this the application will fail when launched. If launched from the Finder the error will read something like "Unable to find >>CarbonLib<<".

4. The code must be native PowerPC for OS X. If you have a sizeable 68K project (over 100 lines?) you can use LXT to make it native PowerPC.

5. You will need a 'carb' resource, id 0, which contains four zeros, otherwise the Mac OS X will boot it as a Classic App. You can add this to the project for Res Copy to copy over. We have supplied one with the sample apps.

6. Notice in the sample app initmac has shrunk - inits are not required for all the managers in Carbon.

7. Also SetPort cannot take a window pointer in Carbon. Either use GetWindowPort to get the port to pass to SetPort, or as we do, use SetPortWindowPort instead.

 

 

Have fun!

 



© 2000 Lightsoft, All rights reserved.
Updated 1st Oct 2000.