Object oriented databae for Python
knizhnik at garret.ru
Mon Mar 24 11:55:28 CET 2003
Friday, March 21, 2003, 9:47:16 PM, you wrote:
GH> * Konstantin Knizhnik <knizhnik at garret.ru> [2003-03-21 21:31 +0300]:
>> Hello achrist,
>> This is problem with definition DL_EXPORT macro in Python 2.2.2 [...]
GH> There is no problem. The problem might be in the Makefiles you use. So
GH> don't use Makefiles. Use distutils through the setup.py I created :-)
May be setup.py is more convenient way of building python modules, but
I still want to build it using makefile or just .bat file.
GH> The only thing you'll likely have to change is the library to link
GH> against, cos MSVC doesn't have any libstdc++. It's called otherwise, but
GH> I don't recall how.
Why I need to explicitly specify some library which is specific for
compiler and compilation model?
GH> The proper solution for setup.py on win32 is to distinguish the compiler
GH> used and then set the appropriate libraries. As that's probably not
GH> easily done, make it configurable in that the user has to edit setup.py
GH> manually, with clear instructions.
If we want function to be exported in DLL at windows we need to
declare it with __declspec(dllexport). This doesn't depends on howwe
are building this library. So themain problem is not in my makefile,
but in lack of correct macro in Python which can be used to define
module initialization function. DL_EXPORT in 2.2. version of Python is not correctly defined and
it will not work neither with my compile.bat neither with your
setup.py (unless you explicitly define DL_EXPORT in command line).
>> With 2.3 it works ok, but not with 2.2.2.
>> May be I just do not define some environment variable. But neither
>> USE_DL_EXPORT, USE_DL_IMPORT properly works:
GH> There is no need to set any defines.
May be there is no needs in defines, but there is need in __declspec(dllexport)
GH> /* Compatibility macros
GH> * From Python 2.2 to 2.3, the way to export the module init function
GH> * has changed. These macros keep the code compatible to both ways.
#if PY_VERSION_HEX >>= 0x02030000
GH> # define PySQLite_DECLARE_MODINIT_FUNC(name) PyMODINIT_FUNC name(void)
GH> # define PySQLite_MODINIT_FUNC(name) PyMODINIT_FUNC name(void)
GH> # define PySQLite_DECLARE_MODINIT_FUNC(name) void name(void)
GH> # define PySQLite_MODINIT_FUNC(name) DL_EXPORT(void) name(void)
But the problem is not with DL_EXPORT at version 2.3 which may be
deprecated but is correctly defined, but with incorrect definition
of DL_EXPORT/DL_IMPORT at Python 2.2 (at least in ActivePython 2.2.2)
And I do not understand how these macros helps to solve the problem.
SQL Lite is not included inPython distribution, so I could not check how
it is build at Windows.
Konstantin mailto:knizhnik at garret.ru
More information about the Python-list