TweetFollow Us on Twitter

Mar 01 ADC Direct Volume Number: 17 (2001)
Issue Number: 3
Column Tag: ADC Direct

Carbon: An Essential Element of Mac OS X

By Mark Turner

One of the things that makes Mac OS X unique is its integration of five separate application runtime environments: Carbon, Cocoa, Classic, Java, and BSD. Never before has an operating system offered developers so many options. This series of articles will give you the information you need to make an informed decision as to which of these environments is right for your application on Mac OS X. This month, I'm going to talk about Carbon and what it offers you as a Macintosh developer.

A Brief History of Carbon

Carbon represents the evolution of the Mac OS API, from a single-user, cooperatively scheduled system, to a modern multi-user system with memory protection and preemptive multitasking. Carbon sprang from Apple's desire to provide a gentle migration path for developers, while at the same time delivering all the performance, features, and reliability that Mac OS X has to offer. About 70 percent of the classic Mac OS APIs are fully supported, and Carbon adds many new APIs specifically to take advantage of Mac OS X.

ADC Programs and Mac OS X

As Steve Jobs, Apple's CEO, announced at Macworld San Francisco in January, Mac OS X will be released on March 24, 2001. All ADC Members who receive a monthly mailing will be automatically sent Mac OS X and the Mac OS X Developer Tools on CD-ROM upon release.

If you are getting your hardware or software products ready for Mac OS X, be sure to take advantage of our numerous ADC Member Discounts for Cocoa and Carbon porting, Aqua integration, driver development services, and more. Mac customers will be looking for hardware and software products that are built for Mac OS X - make sure yours are ready! For the complete list of all ADC

Member Discounts, please see:

http://developer.apple.com/business/

For more information about ADC Programs, please see:

http://developer.apple.com/membership/

What Diamonds Are Made Of

Carbon offers a wealth of features to support and accelerate your Mac OS X development efforts. Whether you're new to the platform, or an old-timer, here are some of the reasons why you'll find Carbon a solid foundation for your software product:

  • Broad Language Support
    Apple provides interfaces, compilers, and tools for Carbon programming in C and C++, while other languages such as BASIC and FORTRAN are offered by other tool vendors.
  • Excellent Tools
    As we covered in last month's article, Tools for the Trade, you can choose from a range of excellent tools including Metrowerks CodeWarrior, Real Software's REALbasic, Absoft Pro Fortran, and Apple's own IDE combo, Project Builder and Interface Builder.
  • Choice of Frameworks
    The two most popular object-oriented application frameworks for Macintosh are now Carbonized: MacApp (part of Apple's suite of C++ frameworks) and Metrowerks PowerPlant (version 2.1 or later). Basing your application on one of these frameworks can greatly simplify your work.
  • Support for Mac OS 9
    Because the majority of Carbon APIs are also supported on Mac OS 9, Carbon provides a solution to the problem of how to move forward with Mac OS X while continuing to support those people who are going to wait a bit longer to upgrade. If backward compatibility is important for your product, you can create a single binary that will run on any version of the Mac OS, from Mac OS 8.1 through Mac OS X.

Getting Started

If you're starting from scratch, and you want to program in C or C++, you should really consider basing your Carbon application on a framework like PowerPlant or MacApp, which provide for rapid development and easy maintenance. These frameworks can also make it easier to port your code to or from the Microsoft Win32 API, if that's a consideration for you. REALbasic and Absoft Pro Fortran also offer cross-platform solutions.

For an excellent introduction to Carbon programming, grab a copy of Moon Travel Tutorial: Creating a Carbon Application. This little gem takes you through the entire process of building a pure Carbon app-one that doesn't rely on any legacy technologies. You'll also learn how to use Apple's Project Builder IDE, and see how easy it is to design your menus, controls, dialogs, and windows using Interface Builder. You can download it from:

http://developer.apple.com/techpubs/macosx/Carbon/pdf/MoonTravel.pdf

The best place to begin exploring Carbon is the Carbon Developer home page, where you'll find links to the latest Carbon software development kits, documentation, tools and other resources:

http://developer.apple.com/macosx/carbon/

If you've already got a Macintosh application that you haven't yet Carbonized, it's time to get started! One of the great things about Carbon is that you can adopt it incrementally. The basic steps necessary to get an application up and running on Mac OS X typically take just a few days, but to completely Carbonize a large application you should expect to spend a month or more, especially if you need to support Mac OS 9 or prior versions.

The ease of Carbonizing an existing application is directly related to how closely you've followed Apple's recommended programming practices in the past, the degree to which you've adopted recent APIs such as Navigation Services and the Appearance Manager, and whether your code already compiles using the latest Universal Interfaces. If your code base is up-to-date, and you're not relying on undocumented data structures or unsupported features, adopting Carbon is relatively simple.

Before changing a line of code, however, you should run your application through Carbon Dater, Apple's Carbon compatibility tester. Available on the Carbon Developer web site, Carbon Dater is a helpful tool that examines your application and issues a report listing all the Mac OS functions you're using that need to be updated for Carbon compatibility. For example, if you're calling InvalRect, the report will explain that the function is not supported in Carbon, and recommend that you use InvalWindowRect instead.

With the Carbon Dater report as your guide, you can begin the Carbonization process by searching your sources for unsupported functions and replacing them with their Carbon equivalents. While I can't cover the entire Carbonization process in detail here, you'll find a complete description in the Carbon Porting Guide, which you can download from here:

http://developer.apple.com/techpubs/macosx/Carbon/pdf/CarbonPortingGuide.pdf

Even if you're not porting, I recommend reading the Carbon Porting Guide for its overview of new Carbon technologies, optimization strategies, and instructions for building Carbon applications using CodeWarrior, Project Builder, and the Macintosh Programmer's Workshop (MPW). Technical Note 2003: Moving Your Code to Mac OS X, is another great resource. It highlights all the major considerations for developers transitioning from classic Mac OS to Carbon, and provides pointers to additional documentation on the web:

http://developer.apple.com/technotes/tn/tn2003.html

Once your application is Carbonized, you'll want to make sure it looks great on Mac OS X. This means putting the polish on your interface by giving it an Aqua tune-up. The Aqua Human Interface Guidelines contains all the specifications and recommendations for designing Aqua-compliant applications and icons:

http://developer.apple.com/techpubs/macosx/SystemOverview/AquaGuidelines.pdf

Project Builder Tips & Tricks

  • To get a pop-up menu containing all the functions in your source files, select "Index Project" from the Project menu. This also enables definition searches from the batch find panel. And, the counterpart button (the third button from the right in the navigation bar) becomes a pop-up menu that shows files that are imported by or dependent on the current file.
  • The inspector panel, available from the Project menu, can be used to modify more than one file at a time. For instance, if you want to set the tab width for a number of files all at once, select them in the Groups and Files pane, bring up the Inspector, change the tab width, and hit return.
  • To set a breakpoint on a line of code, just click in the column to the left of that line of code. Clicking again enables and disables the breakpoint. To remove the breakpoint, drag it off the column. You can also move a breakpoint to a different line by dragging it.
  • To rename a file or group, option-click its name from the Groups and Files pane.

New Mac OS X Related Releases

The following software is available from the Download Software area of the ADC Member Site at: http://connect.apple.com/

  • CarbonLib 1.2.5b2 SDK
    The latest prerelease version of the CarbonLib 1.2.5 software development kit provides all the files needed to begin Carbon development.
    http://connect.apple.com/
  • OpenGL SDK 1.2
    This software development kit is for adding OpenGL support to your application. This implementation provides several features and performance enhancements.
    http://developer.apple.com/opengl/downloads.html

Developer Documentation

The following new and updated documentation is available to help you on your way to successful Mac OS X application and peripheral development at: http://developer.apple.com/techpubs/

  • Q&A QA1000 - Gathering system information under Traditional Mac OS
  • SAMPLECODE - Graphics 3D: Carbon SetupGL
  • SAMPLECODE - Graphics 3D: OpenGL Movie
  • SAMPLECODE - Platforms and Tools: Project Builder: Cocoa_With_Carbon_or_C++
  • SAMPLECODE - Networking: OTStreamLogViewer
  • SAMPLECODE - Networking: OTClassicContext
  • SAMPLECODE - Devices and Hardware: Drivers: TradDriverLoaderLib

Mac OS X: An Overview for Developers
This 10-page PDF highlights the benefits of Mac OS X technologies to developers. http://developer.apple.com/macosx/

Fatbrain's Apple Developer Library
The following four titles have been added to the Apple Developer Library, the ADC's print-on-demand series of titles located at: http://www1.fatbrain.com /apple/

  • Carbon Porting Guide for Mac OS X
  • Inside WebObjects: WebObjects Overview
  • Inside Mac OS X: Kernel Environment
  • Inside Cocoa: Object-Oriented Programming and the Objective-C Language

Upcoming Seminars and Events

For more information on Apple developer events please visit the developer Events page at: http://developer.apple.com/events/

Training and Seminars

Programming with Cocoa
Taught by Aaron Hillegass at the Big Nerd Ranch, Ashville, NC and Atlanta, GA. Five-day classes are taught on developing web-based and Mac OS X applications.

http://www.bignerdranch.com/when.html

Developer Related Conferences

Game Developer Conference, San Jose, CA
March 20-24

For 15 years, the Game Developers Conference (GDC) has been the independent and unbiased forum where game development professionals from around the world gather to share ideas and build the skills essential to creating the next generation of interactive entertainment. Apple will be exhibiting at this year's conference.

Worldwide Developers Conference (WWDC) 2001
San Jose, CA
May 21-25

Register now for Apple's Worldwide Developers Conference 2001, which takes place in San Jose, California from May 21-25. ADC Premier members receive a free pass to the conference, ADC Select members receive discounts for early registration, and ADC Student members can apply for a scholarship to attend for free! For schedules and other details check out:

http://www.apple.com/developer/wwdc2001/

If you missed last year's conference, a great way to get ready for WWDC 2001 is to purchase our five volume WWDC 2000 Conference Sessions on DVD-ROM. This set contains over 80 hours of detailed technical information from WWDC 2000 and is deeply discounted for ADC Members. Additional information on this product can be found at:

http://developer.apple.com/products/

MacHack Conference, Dearborn, MI
June 21-23

MacHack, in its sixteenth year, remains centered around cutting edge software development. MacHack's uniqueness derives from the informal feel and the LIVE coding that occurs around-the-clock during the conference.

http://www.machack.com/

An Investment in the Future

Carbon is more than just a porting tool. It's a full-featured API that provides a solid foundation for serious ongoing development. Apple is working hard to make sure Carbon has everything you need to write world-class applications, now and in the future.

Mac OS X, with its killer graphics and superior performance, presents an opportunity for you to revitalize or even reinvent your application. Your goal should be more than simply getting your code running on Carbon-it should be to create a compelling new product that takes advantage of everything Mac OS X has to offer.

When you're finished, be sure to let Apple know about your product, so we can list it on the "Built for Mac OS X" web page located in the Mac Products Guide (MPG):

http://submit.macsoftware.apple.com/usupdate/upindex.html

Until Next Time

With Mac OS X shipping on March 24, the demand for native applications will be huge. Carbon is one way to bring your Mac OS X product to market quickly. Future articles will cover Cocoa, Java, and other options for Mac OS X development.

Whatever path you choose, Apple's Worldwide Developer Relations team is here to help. For technical support, visit http://developer.apple.com/products/techsupport/. Better yet, sign yourself up on the Carbon Development discussion list (carbon-development@lists.apple.com). This list is monitored by Apple technology managers, engineers, and your fellow developers from around the world. It's a great place to get answers or share your knowledge, and it's free. To sign up, go to http://lists.apple.com and search for Carbon Development. See you there!

Discounts on Mac OS X Migration

Bring Your Apps to Mac OS X

With Mac OS X Public Beta here, and the commercial release just over the horizon, Mac developers everywhere have a huge need for Carbon and Cocoa application porting, Aqua user interface implementation, and driver development services. Several high-quality software engineering firms, in association with the Apple Developer

Connection, are offering these services at very attractive discounts to all ADC Select and Premier members.

http://developer.apple.com/mkt/macosxmigration.html

End-User Tech Support

We all know how expensive and time consuming it is to set-up and maintain a comprehensive customer tech support department. To support developers in their migration to Mac OS X, 877MacTank has designed an exclusive and affordable tech support staffing program for ADC Premier and Select members.

http://developer.apple.com/mkt/mactank.html

Did You Know?

Much of Apple's technical documentation is geared toward helping Carbon application developers. To see the scope of this documentation, check out the Carbon documentation suite on the Web at:

http://developer.apple.com/techpubs/macosx/Carbon/carbon.html

Here you will find the "Inside Carbon" suite of API documentation for the nearly 100 Carbon-compatible managers, organized by topic. This documentation includes Carbon inclusion status, per-function release availability, and porting notes to help you modify your legacy Mac OS code for functions that aren't supported. Some documents also describe concepts and include sample code to help you revise your legacy Mac OS applications for Carbon and to create new Carbon applications. You'll also find at the Carbon documentation site a number of relevant programming guides, such as "Aqua Human Interface Guidelines," "Carbon Porting Guide," and "Moon Travel Tutorial: Creating a Carbon Application."

The Carbon documentation suite is also available on the Mac OS X Developer CD. When you install the Developer package, you can also access this documentation from the Developer Help Center using the Help Viewer application.

If you have legacy Macintosh applications that you wish to port, be sure to use the Carbon Dater tool. Carbon Dater produces an HTML report customized for your application. The report lists function calls and code usage that you may need to change, and offers the latest documentation to help you make those changes. Although the Carbon documentation site provides a link to Carbon Dater, the tool itself is not included on the Developer CD.

Carbon Tips & Tricks

The Apple Developer Connection web site titled Carbon "Tips & Tricks" is dedicated to sharing special techniques for debugging and building Carbon applications.

Visit us at:

http://developer.apple.com/macosx/carbon/tipsandtricks.html


Mark Turner is the Carbon Technology Manager in Apple Worldwide Developer Relations. When he's not Carbonizing code, he enjoys carbonizing hamburgers on the grill and spending time with his family. He can be reached at turner@apple.com.

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Tor Browser 12.5.5 - Anonymize Web brows...
Using Tor Browser you can protect yourself against tracking, surveillance, and censorship. Tor was originally designed, implemented, and deployed as a third-generation onion-routing project of the U.... Read more
Malwarebytes 4.21.9.5141 - Adware remova...
Malwarebytes (was AdwareMedic) helps you get your Mac experience back. Malwarebytes scans for and removes code that degrades system performance or attacks your system. Making your Mac once again your... Read more
TinkerTool 9.5 - Expanded preference set...
TinkerTool is an application that gives you access to additional preference settings Apple has built into Mac OS X. This allows to activate hidden features in the operating system and in some of the... Read more
Paragon NTFS 15.11.839 - Provides full r...
Paragon NTFS breaks down the barriers between Windows and macOS. Paragon NTFS effectively solves the communication problems between the Mac system and NTFS. Write, edit, copy, move, delete files on... Read more
Apple Safari 17 - Apple's Web brows...
Apple Safari is Apple's web browser that comes bundled with the most recent macOS. Safari is faster and more energy efficient than other browsers, so sites are more responsive and your notebook... Read more
Firefox 118.0 - Fast, safe Web browser.
Firefox offers a fast, safe Web browsing experience. Browse quickly, securely, and effortlessly. With its industry-leading features, Firefox is the choice of Web development professionals and casual... Read more
ClamXAV 3.6.1 - Virus checker based on C...
ClamXAV is a popular virus checker for OS X. Time to take control ClamXAV keeps threats at bay and puts you firmly in charge of your Mac’s security. Scan a specific file or your entire hard drive.... Read more
SuperDuper! 3.8 - Advanced disk cloning/...
SuperDuper! is an advanced, yet easy to use disk copying program. It can, of course, make a straight copy, or "clone" - useful when you want to move all your data from one machine to another, or do a... Read more
Alfred 5.1.3 - Quick launcher for apps a...
Alfred is an award-winning productivity application for OS X. Alfred saves you time when you search for files online or on your Mac. Be more productive with hotkeys, keywords, and file actions at... Read more
Sketch 98.3 - Design app for UX/UI for i...
Sketch is an innovative and fresh look at vector drawing. Its intentionally minimalist design is based upon a drawing space of unlimited size and layers, free of palettes, panels, menus, windows, and... Read more

Latest Forum Discussions

See All

Listener Emails and the iPhone 15! – The...
In this week’s episode of The TouchArcade Show we finally get to a backlog of emails that have been hanging out in our inbox for, oh, about a month or so. We love getting emails as they always lead to interesting discussion about a variety of topics... | Read more »
TouchArcade Game of the Week: ‘Cypher 00...
This doesn’t happen too often, but occasionally there will be an Apple Arcade game that I adore so much I just have to pick it as the Game of the Week. Well, here we are, and Cypher 007 is one of those games. The big key point here is that Cypher... | Read more »
SwitchArcade Round-Up: ‘EA Sports FC 24’...
Hello gentle readers, and welcome to the SwitchArcade Round-Up for September 29th, 2023. In today’s article, we’ve got a ton of news to go over. Just a lot going on today, I suppose. After that, there are quite a few new releases to look at... | Read more »
‘Storyteller’ Mobile Review – Perfect fo...
I first played Daniel Benmergui’s Storyteller (Free) through its Nintendo Switch and Steam releases. Read my original review of it here. Since then, a lot of friends who played the game enjoyed it, but thought it was overpriced given the short... | Read more »
An Interview with the Legendary Yu Suzuk...
One of the cool things about my job is that every once in a while, I get to talk to the people behind the games. It’s always a pleasure. Well, today we have a really special one for you, dear friends. Mr. Yu Suzuki of Ys Net, the force behind such... | Read more »
New ‘Marvel Snap’ Update Has Balance Adj...
As we wait for the information on the new season to drop, we shall have to content ourselves with looking at the latest update to Marvel Snap (Free). It’s just a balance update, but it makes some very big changes that combined with the arrival of... | Read more »
‘Honkai Star Rail’ Version 1.4 Update Re...
At Sony’s recently-aired presentation, HoYoverse announced the Honkai Star Rail (Free) PS5 release date. Most people speculated that the next major update would arrive alongside the PS5 release. | Read more »
‘Omniheroes’ Major Update “Tide’s Cadenc...
What secrets do the depths of the sea hold? Omniheroes is revealing the mysteries of the deep with its latest “Tide’s Cadence" update, where you can look forward to scoring a free Valkyrie and limited skin among other login rewards like the 2nd... | Read more »
Recruit yourself some run-and-gun royalt...
It is always nice to see the return of a series that has lost a bit of its global staying power, and thanks to Lilith Games' latest collaboration, Warpath will be playing host the the run-and-gun legend that is Metal Slug 3. [Read more] | Read more »
‘The Elder Scrolls: Castles’ Is Availabl...
Back when Fallout Shelter (Free) released on mobile, and eventually hit consoles and PC, I didn’t think it would lead to something similar for The Elder Scrolls, but here we are. The Elder Scrolls: Castles is a new simulation game from Bethesda... | Read more »

Price Scanner via MacPrices.net

Clearance M1 Max Mac Studio available today a...
Apple has clearance M1 Max Mac Studios available in their Certified Refurbished store for $270 off original MSRP. Each Mac Studio comes with Apple’s one-year warranty, and shipping is free: – Mac... Read more
Apple continues to offer 24-inch iMacs for up...
Apple has a full range of 24-inch M1 iMacs available today in their Certified Refurbished store. Models are available starting at only $1099 and range up to $260 off original MSRP. Each iMac is in... Read more
Final weekend for Apple’s 2023 Back to School...
This is the final weekend for Apple’s Back to School Promotion 2023. It remains active until Monday, October 2nd. Education customers receive a free $150 Apple Gift Card with the purchase of a new... Read more
Apple drops prices on refurbished 13-inch M2...
Apple has dropped prices on standard-configuration 13″ M2 MacBook Pros, Certified Refurbished, to as low as $1099 and ranging up to $230 off MSRP. These are the cheapest 13″ M2 MacBook Pros for sale... Read more
14-inch M2 Max MacBook Pro on sale for $300 o...
B&H Photo has the Space Gray 14″ 30-Core GPU M2 Max MacBook Pro in stock and on sale today for $2799 including free 1-2 day shipping. Their price is $300 off Apple’s MSRP, and it’s the lowest... Read more
Apple is now selling Certified Refurbished M2...
Apple has added a full line of standard-configuration M2 Max and M2 Ultra Mac Studios available in their Certified Refurbished section starting at only $1699 and ranging up to $600 off MSRP. Each Mac... Read more
New sale: 13-inch M2 MacBook Airs starting at...
B&H Photo has 13″ MacBook Airs with M2 CPUs in stock today and on sale for $200 off Apple’s MSRP with prices available starting at only $899. Free 1-2 day delivery is available to most US... Read more
Apple has all 15-inch M2 MacBook Airs in stoc...
Apple has Certified Refurbished 15″ M2 MacBook Airs in stock today starting at only $1099 and ranging up to $230 off MSRP. These are the cheapest M2-powered 15″ MacBook Airs for sale today at Apple.... Read more
In stock: Clearance M1 Ultra Mac Studios for...
Apple has clearance M1 Ultra Mac Studios available in their Certified Refurbished store for $540 off original MSRP. Each Mac Studio comes with Apple’s one-year warranty, and shipping is free: – Mac... Read more
Back on sale: Apple’s M2 Mac minis for $100 o...
B&H Photo has Apple’s M2-powered Mac minis back in stock and on sale today for $100 off MSRP. Free 1-2 day shipping is available for most US addresses: – Mac mini M2/256GB SSD: $499, save $100 –... Read more

Jobs Board

Licensed Dental Hygienist - *Apple* River -...
Park Dental Apple River in Somerset, WI is seeking a compassionate, professional Dental Hygienist to join our team-oriented practice. COMPETITIVE PAY AND SIGN-ON Read more
Sublease Associate Optometrist- *Apple* Val...
Sublease Associate Optometrist- Apple Valley, CA- Target Optical Date: Sep 30, 2023 Brand: Target Optical Location: Apple Valley, CA, US, 92307 **Requisition Read more
*Apple* / Mac Administrator - JAMF - Amentum...
Amentum is seeking an ** Apple / Mac Administrator - JAMF** to provide support with the Apple Ecosystem to include hardware and software to join our team and Read more
Child Care Teacher - Glenda Drive/ *Apple* V...
Child Care Teacher - Glenda Drive/ Apple ValleyTeacher Share by Email Share on LinkedIn Share on Twitter Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.