Re: Building and embedding python with borland c

Guido.van.Rossum@cwi.nl
Wed, 16 Mar 1994 00:42:09 +0100

Does the borland compiler create makefiles for you? Basically
compiling Python is fairly simple: you select the files what you want,
compile them all and put them in a library, with the exception of
config.c, which contains main(). I figured this out for MSVC++ 1.0 in
about an hour without having ever used it before (and hardly any
recent DOS knowledge either). If Python's directory structure is
inconvenient for DOS, just put the contents of the directories Parser,
Python, Objects, Modules and Includes together. Some files from
Parser are not needed (especially pgenmain.c) -- some other files
aren't needed either, it requires a little experimentation.

Some tricks that make it less simple:

You need a config.h file. You can start with config.h.in and edit it
-- it is heavily commented. You must somehow define HAVE_CONFIG_H,
else config.h is not included. On UNIX yous put -DHAVE_CONFIG_H on
the compiler command line.

You also need a config.c. If you have the opportunity, generate one
on UNIX and later comment out modules you don't need. Otherwise
you'll have to copy config.c.in to config.c and add lines for modules
you wish to add manually.

Finally you need to decide which optional modules to use and tell the
compiler to compile only these. (They are all optional except sys and
builtin.) For DOS, you definitely want dos, math, strop, array, and
some other ones I can't be bothered to remember right now :-) A
possible strategy is to start compiling *all* modules and remove the
ones that give compile time errors about include files not found.

Hope this helps,

--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
URL: <http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>