statics everywhere. Why?

Andrew M. Kuchling akuchlin at mems-exchange.org
Wed Nov 10 13:27:15 EST 1999


"Arinte" <shouldbe at message.com> writes:
> Embedding python in a c application, why do I need to make the functions
> that python call and variables for callbacks static?

In the modules that come with Python, all of these functions are
defined as static.  I think this is simply done to keep those symbols
private, to avoid causing collisions when you link libpython.a into
your application; you'd be unhappy if a get_group_num() function in
the re module conflicted with a get_group_num() function in your code.
For your own internal application, it's up to you whether such symbols
should be kept private or not.

(Note that this applies to functions and global variables defined as
'static'; the 'static' keyword means something different inside a C {
} block.)

-- 
A.M. Kuchling			http://starship.python.net/crew/amk/
The Kappamaki, a whaling research ship, was currently researching the
question: How many whales can you catch in one week?
    -- Terry Pratchett & Neil Gaiman, _Good Omens_






More information about the Python-list mailing list