distutils question

Fredrik Lundh fredrik at pythonware.com
Fri Sep 9 12:47:51 EDT 2005


Joachim Dahl wrote:

> E.g., say I want to compile a project as:
>
> gcc -Ddef1 -c foo.c -o foo_def1.o
> gcc -Ddef2 -c foo.c -o foo_def2.o
> gcc foo_def1.o foo_def2.o -o myext_module.o
>
> How would I do that using distutils? It doesn't seem to be possible with
> the normal core.setup method, and distutils.ccompiler seems to be the
> best option, but I couldn't get it working...

easy: add a new C file (e.g. myext_module.c) that includes "foo.c"
twice (using define/undef/ifdef), and compile the new file instead.

almost as easy: change foo.c so it includes itself.

</F> 






More information about the Python-list mailing list