
Message 8 of 8 for search building PYD
return to search results |
help |
Re: PYD files
|
sponsored by:
|
|
Message segment 1 of 2
- Get
Next Segment
- Get All 2 Segments
> I am quite new in Python and I am using PythonWin for WinNT. I would be more than happy if I
> could get some answers on the following questions:
And I would be more than happy to answer them :-)
> - How to built PYD files?
> - Which files are necessary to build PythonWin itself? (Do I need any header files from Python's
> distribution for the SGIs - Sun machines ?)
> - How to use RC files to built an application using dialogs, menus, icons e.t.c? (I have noticed
> an example RESDEMO.PY in the scripts directory of Python-09-03 distribution using a RESTEST.DLL,
> how this DLL was built, is it necessary to built DLLs so as to use RC files?)
> - How to build Py130-1.dll?
I took the opportunity to add this to my main documentation. Ive
pasted in what I documented:
> - Is it possible to use DLL-like files in WPY?
> - Do WPY and PythonWin differ only in the User Interface?
I think the first question depends on the WPY platform. DLL
extensions are only possible if core Python is in a DLL. AFAIK, some
versions of WPY (win3.1?) use a staticly linked Python, meaning
extensions wont work.
WPY and Pythonwin differ fairly significantly, unfortunately.
Mark.
[Excuse the formatting]
Building Python Core
The Python core builds the Python DLL, as well as the "console mode" Python.exe. The steps to build this are:
Grab the standard Python Unix sources.
Grab the latest version of the Win32 core source patches - currently, these can be found at python-src-130-2.zip.
Unzip this (with -d) over the standard Unix sources. Ensure you overwrite all files.
Run "vcvars32.bat" to ensure the paths for the compiler are setup.
Run `make_nt.bat"NODEBUG=1"' or `make_95.bat "NODEBUG=1"'.
Building Pythonwin
. Build Python as above (or else get the Python header files, and the .libs etc. from the appropriate file - see the Pythonwin index.
. Grab the Pythonwin sources (see the Pythonwin index for the latest file name).
. Unzip with -d
. Edit make.bat - edit the line "set STDOPTS="pythondir=\src\python" to something appropriate. This should point to the main Python directory.
. run "make.bat". This simply invokes nmake on all the sub-directories. You may need to open the MSVC maintained projects, and edit the include paths etc.
To build debug versions, you will need to open the projects in MSVC, and select the appropriate mode.
Additional Problems
When you build new versions, you may have problems running them. This is likely because Python will use the registry to locate the .pyd files. The registry is probably not pointing at the release version.
To get around this, I use a "pythonpath" environment variable. I set the variable in a DOS command prompt, then start Pythonwin (or MSVC (msdev.exe) then Pythonwin) from the command prompt. This allows this version of Python to execute under this envir
o
nment.
This is even more complicated with the registration of modules. See "setdevenv.bat" or possibly "setdevenv.py" for an example.
Building extension modules
To build Python extension DLL files (.pyd files) you must:
. Grab the file with all Pythonwin and Python .lib files. See the Pythonwin index.
. Grab all Python header files (you probably need to grab the full source archive).
. Write an extension module as you would for any other platform - except - the code must be compilable as a C++ file (even if a .C file).
. Find any "makefile_nt.msc" for another module, and edit it appropriately. The changes should be fairly obvious (limited to changing the module name and path to the Python core).
. Run the make.
Message segment 1 of 2
- Get
Next Segment
- Get All 2 Segments