[niemeyer@conectiva.com: Re: [Python-Dev] Python's footprint]

M.-A. Lemburg mal@lemburg.com
Sat, 12 Jan 2002 13:27:38 +0100


Martin v. Loewis wrote:

>>#define __init      __attribute__ ((__section__ (".text.init")))
>>
> [...]
> 
>>After surrounding doc strings with a macro, this will be easy to achieve.
>>
> 
> Unfortunately, not with the doc string you propose. Apparently, your
> macro is going to be used as
> 
> char foo__doc__[] = Py_DocString("this is foo");
> 
> However, with the attribute, the resulting code should read
> 
> char foo__doc__[] __attribute__((__section__("docstring")) = 
>   "this is foo";
> 
> You cannot define the macro so that it comes out as expanding to
> __attribute__, atleast not with that specific macro.


Why don't you use macro which only takes the name of the
static array and the doc-string itself as argument ? This
could then be expanded to whatever needs to be done for
a particular case/platform, e.g.

Py_DefineDocString(foo__doc__, "foo does bar");

(I use such an approach in the mx stuff and it works great.)

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Company & Consulting:                           http://www.egenix.com/
Python Software:                   http://www.egenix.com/files/python/