bartop

palmoswerks ARCHIVE
Palm OS programming tips from a (former) CodeWarrior insider

header

Navigation

Search
Home
About
Stories
Stuff I Like
Articles
PilRC
CodeWarrior
palmos.techwood.org
DevTools List
Palm OS Dev FAQ

Palm OS Precompiled Headers

Author:   Ben Combee  
Posted: 5/28/02; 3:56:52 AM
Topic: Palm OS Precompiled Headers
Msg #: 70 (top msg in thread)
Prev/Next: 69/71
Reads: 1809

In CodeWarrior for Palm OS V8, new projects are created out of the wizard using one of the prebuilt precompiled header files we ship in the box. The four precompiled header files are

  • PalmOS_Headers
  • PalmOS_Headers_Strict
  • PalmOS_Headers_Debug
  • PalmOS_Headers_Strict_Debug

These headers are built using the BuildHeaders.mcp project. Since the IDE's browser system doesn't read symbols out of precompiled headers, we rely on a link to this BuildHeaders project to import the symbols into the IDE for coloring and hyperlink purposes. If you delete this linked project from your project, you'll lose the browser coloring for Palm OS API functions.

On your disk, the output files for these live in the CW for Palm OS SupportPrecompiled Headers" folder, with the exception of "PalmOS_Headers" which is output into the "Palm OS SupportIncs" folder.

For new projects, the precompiled headers are used via the C/C++ Compiler panel's prefix file setting. We just directly include either the "Palm_OS_Headers_Strict" or "Palm_OS_Headers_Strict_Debug" precompiled header as a default.

For people moving older code into CW, this can cause some problems, especially if you need to turn on a header option to allow access of system data structures. With the 4.0 SDK, Palm added features that allowed most of the system data types to be made opaque, giving compiler errors if you tried to instantiate them in a program or use their members.

If you need to use these structures for some reason, like writing glue code for older devices, you need to disable this "strict" mode. The way to do it is to #define one or more of these symbols before you include PalmOS.h:

  • ALLOW_ACCESS_TO_INTERNALS_OF_CLIPBOARDS
  • ALLOW_ACCESS_TO_INTERNALS_OF_CONTROLS
  • ALLOW_ACCESS_TO_INTERNALS_OF_FIELDS
  • ALLOW_ACCESS_TO_INTERNALS_OF_FINDPARAMS
  • ALLOW_ACCESS_TO_INTERNALS_OF_FORMS
  • ALLOW_ACCESS_TO_INTERNALS_OF_LISTS
  • ALLOW_ACCESS_TO_INTERNALS_OF_MENUS
  • ALLOW_ACCESS_TO_INTERNALS_OF_PROGRESS
  • ALLOW_ACCESS_TO_INTERNALS_OF_SCROLLBARS
  • ALLOW_ACCESS_TO_INTERNALS_OF_TABLES
  • ALLOW_ACCESS_TO_INTERNALS_OF_BITMAPS
  • ALLOW_ACCESS_TO_INTERNALS_OF_FONTS
  • ALLOW_ACCESS_TO_INTERNALS_OF_WINDOWS

With the defaults, you have the problem that you're include of PalmOS.h will be ignored, since its already been included by the precompiled header file.

To disable this header, just blank out the prefix file setting. I'd suggest actually building your code that does direct structure access into a static library using your custom settings, and then linking that into the main project that builds the app strictly.

You also could just make your own precompiled header that allows the proper settings -- looking at BuildHeaders.mcp is a good idea to see how precompiled header files are produced.

Blog Responsibility

The Seattle News ran an article on Sunday about blogs, and how they are moving from the individual world into corporations. One of the comments made in this article is that weblogs that are sponsored or affiliated with companies need to be clear about their affiliation, so their readers can decide how much credibility they will invest in the blog's articles and opinions.

I agree with this sentiment, so here's my little disclosure: this blog is not an official Metrowerks communication, but it is affiliated to the company through my employment, so be sure to read anything published here with that in mind. I will do my best to be honest and open, but I won't publish information that will hurt my or my employer's interests.


Send feedback to combee@techwood.org
Copyright © 2004 Benjamin L. Combee
Palm OS is a registered trademark of PalmSource, Inc.
Metrowerks and CodeWarrior are registered trademarks of Metrowerks Inc.

The views expressed on this website/weblog are those of mine alone and do not necessarily reflect the views of PalmSource or Metrowerks.

This is a Manila Site

qwertYAK / frobnovich