"Rob Graber" <[EMAIL PROTECTED]> wrote in message
news:10793@palm-dev-forum...
> Doesn't #including a file in a .c file basically just tell the
> c-preprocessor to put that file's text in the current file?
Yes, but the #pragma once or #ifndef __FOO_H__ prevents it from being
#included more than once.
> Since I am
> running into a problem with the 32k jump limit, just including the file as
> text from a .h file doesn't seem to me like it will solve my main problem.
In general, .h files only include typedefs, constants (#defines), function
prototypes, externed globals, and stuff like that - nothing that the
compiler allocates space for. So including a .h file in several .c files
doesn't cause any code duplication.
In this case, by putting the function prototype in the .h file, you're
ensuring that the caller and callee agree. Both include the .h file which
has the function prototype, so if either disagrees with the function
prototype, you'll get a compile error.
Separating your code into several .c files, each with its own .h file, is a
step you'll need to take to make a multi-segment app. You'll also need to
tell the compiler which .c files go in which segments. The .h files
shouldn't need to be in the project. Read the CodeWarrior docs on
multi-segment apps for details. (I'm assuming you're using CodeWarrior.)
Some things to watch out for:
- Turn off Link Single Segment under 68K Linker in your target settings.
- Use a different startup library (see the docs for details).
- Code used during normal launch (and goto with globals) can be in any
segment. Code for other launch codes must be in the first segment and can't
use app globals.
I'd check the archive of this mailing list for discussions of multi-segment
apps for other tips.
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/