Hi to all PRC-tool users.

If you prefer multigen and are bored with putting section names for
functions, this simple perl script might be able to comfort you:

        http://palmalley.tripod.com/palm-annotate.html


This is a temporary site, please don't bookmark it.

Feliz A�o Nuevo
M.




-----Original Message-----
From: Peter Epstein [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 28 November 2001 1:00 PM
To: Palm Developer Forum
Subject: RE: #ifndef...


This same issue came up today in another thread. The usual approach is to
put an extern declaration of the variable without an initializer (no "= foo"
on the end) in a header file, to include this header file in each
compilation unit (.c file) that needs to refer to it, and finally, to define
the variable without the extern keyword and with an initializer in just one
of the .c files. This should give you consistent results across different C
compilers, providing access to a single global variable across multiple
compilation units.

The approach of using #ifndef as you described is useful in header files. If
you wrap each header file with one of these, each having it's own unique
symbol based on the name of the file, then you can avoid redeclaration of
variables caused by the same header file being included twice. This can
happen when one header file includes another. In CodeWarrior, you can use
#pragma once to get the same effect, but it's not portable to different
compilers. These errors can be hard to track down because it's not obvious
what the include chain looks like. In this case, I think the problem is that
you're missing the extern keyword in your header file declarations.
-- 
Peter Epstein

-- 
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/

--
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to