PythonD DXE Extensions: 1.July.2003, PythonD 2.2.1 V 2.0:
Python ‘distutils’, used for the quick building of Python- and C-based extensions from source, now functions to a limited degree under PythonD. PythonD modules may link dynamically using the new DJGPP ‘DXE’ extension. Creating PythonD DXE extensions requires DJGPP and DXE3GEN, as well as Long FileName support. A version of Daniel Borca´s dynamic library builder is included with the PythonD base distribution.
Developers please note that the Standard Python Library is installed at:
os.path.join(prefix, "lib", "python" + sys.version[:1])
(the standard declaration uses 'sys.version[:3]')
This is for dos 8.3 compatibility (one library for both LFN and non-LFN!).
Please note that all global symbols provided to resolve dynamic modules from the main image had to be exported individually from the source code. Now, PythonD sources export over 700 individual C tokens to DXEs that use C/C++ library calls (like ‘printf’ or ‘gethostname’, whatever). But it still might be possible that your package requires a librray function that has not (yet) been added to the export list.
The new DJGPP 'DXE3GEN' and dl library supports external library dependencies. This feature is used to resolve module DXEs that require routines that are not provided from the PythonD executable through another DXE. See the OpenGL page for an example of how this is implemented. The folder in which these system DXEs (Dynamic Extensions) are extracted is the 'lib' subdirectory of your PythonD installation by default. Even when using PythonD with DJGPP installed, you still need to define this environment:
If you do not have DJGPP installed, and extracted PythonD all under D:\Python, you then need to declare:
You may resolve the needed function by linking your DXE then with an additional static library at the DXE3GEN command line. When third party libraries are needed by a DXE (like socketmodule), additional libraries may be specified with the -l option. Do not link your DXE with either libc.a or libgcc.a (“-lc” option). This will break PythonD IO control and return a sigfault. See the DXE documentation for extended details on building shared libraries with DXE3GEN, or type “DXE3GEN -h”.
The following C and C++ routines are provided to resolve all DXEs loaded with PythonD: