Note that the versions of Python beyond 1.5.2 don't include the python??.lib file that was used 
for generating our C++Builder lib file! See section 6 that shows an alternate way for building 
the .lib file.

By using C++ Builder, you benefit of the ease of use of the "Python for Delphi"
components and the full access to the Python C API.
Note that <INSTALLDIR> must be replaced by the path where you installed
"Python for Delphi".

1) Creation of the py15.lib
2) Usage of the C python15.dll
3) Usage of the TPythonEngine
4) Usage of TPythonEngine and python15.dll simultaneously
5) Notes
6) Python 2.1

------------------------------------------------------------------------
1) Creation of the py15.lib
   ########################

If you want to use the C API of the python15.dll in your project,
you need to have a .lib for the static linking. 
The Python standard distribution provides a python15.lib in the
windows\system directory, but this was generated by the Microsoft
Visual tools and uses the COFF format, whereas the Borland tools
use the Intel OMF format.
Hopefully, Borland provides a utility called coff2omf which converts
this library to the expected format.
Type the following command in a dos box:
cd c:\windows\system
coff2omf python15.lib py15.lib

Now, you may add the py15.lib into your projects and you'll link to
the python15.dll

Note that this py15.lib is already available in the <INSTALLDIR>\Components folder.

------------------------------------------------------------------------
2) Usage of the C python15.dll
   ###########################

If you want to use the Python C API, you'll need the py15.lib for the static
linking and the C headers. See point 1) for the py15.lib
You can get the C Headers at the Python site (http://www.python.org),
but the files are included in this distribution for your convenience
(<INSTALLDIR>\Components\Include). Note that I slightly changed the
python.h: I added the "Py" namespace in order to avoid a name conflict
between the "Python for Delphi" components and the C API.

Here are the steps for compiling with the python15.dll:
* Add the <INSTALLDIR>\Components\py15.lib to your project
* Edit your project options, select the "Directories/Conditionals" page,
and add "<INSTALLDIR>\Components\Include" to the "Include path" field.
* In your source code, add a "#include <python.h>"
followed by "using namespace Py;"
* That's all !

Look at the Demo18 for a concrete example.

------------------------------------------------------------------------
3) Usage of the TPythonEngine
   ##########################

If you want to compile a project using the "Python for Delphi" components,
you need to specify some folders for the compiler:
Edit your project options, select the "Directories/Conditionals" page,
and add "<INSTALLDIR>\Components\Sources\Core;<INSTALLDIR>\Components\Sources\VCL"
to the fields "Include Path" and "Library path".

Look at the Demo19 for a concrete example.

------------------------------------------------------------------------
4) Usage of TPythonEngine and python15.dll simultaneously
   ######################################################

If you need to use some TPythonEngine methods like PyArg_ParseTuple,
the compiler can't resolve the external references, so you should
use the Python C API for this job.
Follow the instructions of 3) and 2), but do not add the "using namespace Py;"
instruction. We need indeed the namespace in order to differentiate the
components types and C types.
So, if you need the PyArg_ParseTuple function, you must qualify it with
"Py::" and you must cast all PPyObject types to a (Py::PyObject *).
Example:
int __fastcall TPyPoint::SetAttr(char * key, PPyObject value)
{
  Py::PyObject * val = (Py::PyObject *)value;
  if ( strcmp(key, "x") == 0 ) {
    if ( Py::PyArg_Parse( val, "i:Point.SetAttr", &x ) )
      return 0;
    else
      return -1;
...

Look at the Demo20 for a concrete example.

------------------------------------------------------------------------
5) Notes
   #####

In order to get the C++ Builder packages compile, you must always check
that the "Debug information" option is unchecked in the the "Pascal" page
of the package options.

------------------------------------------------------------------------
6) Python 2.1

Use the implib command located in your CBuilderXXX\bin folder:
implib -a <INSTALLDIR>\Components\py21.lib WINNT\SYSTEM32\python21.dll

Do the same other steps, replacing py15.lib with py21.lib. Be sure to remove any former py15.lib file 
that could be included in your project file (.bpr).

