python header puzzle

Lemures Lemniscati lemures.lemniscati@gmail.com
Sat Jan 2 02:13:38 GMT 2021


On Sat, 02 Jan 2021 07:30:05 +0900, Lemures Lemniscati
> On Fri, 1 Jan 2021 19:33:03 +0100, Marco Atzeri via Cygwin
> > Hi All,
> > 
> > trying to build postgresql 12.X with python3 interface, I hit an
> > interesting issue
> > 
> > all headers
> > /usr/include/python{3.6-3.8}/pyport.h
> > 
> > are including
> > 
> > #                       if defined(__CYGWIN__)
> > #                               define PyMODINIT_FUNC __declspec(dllexport) PyObject*
> > #                       else /* __CYGWIN__ */
> > #                               define PyMODINIT_FUNC PyObject*
> > #                       endif /* __CYGWIN__ */
> > 
> > and the postgresql python 3 interface has in the code and the header
> > src/pl/plpython/plpy_plpymodule.{h,c}
> > 
> > the following lines:
> > 
> > PyMODINIT_FUNC PyInit_plpy(void);
> > 
> > PyMODINIT_FUNC PyInit_plpy(void)...
> > 
> > Unfortunately the shared lib produced is crippled and does not
> > export correctly the symbols.
> > 
> > Changing the lines in
> > 
> > extern PyObject* PyInit_plpy(void);
> > 
> > PyObject* PyInit_plpy(void)..
> > 
> > solves the problem and pass all tests.
> > 
> > At first glance the Python headers seem the wrong one; the postgresql
> > code has no special  CYGWIN handling in that point, just the note
> > 
> >   * Must have external linkage, because PyMODINIT_FUNC does dllexport on
> >   * Windows-like platforms.
> > 
> > Comments ?
> > Any one seeing similar issue with Python3 code ?
> > 
> > For what I see the usage of PyMODINIT_FUNC is very limited
> > only python-cffi and python-lxml seem to use it in their headers
> 
> 
> How about like this, though it should need more refinements.
> 
> A cygport file is attached, or placed at
> https://github.com/cygwin-lem/cygwin-pkg/tree/w_postgresql-12.5-1/postgresql
> 
I'm sorry. I was wrong.

Regards,

Lem


More information about the Cygwin mailing list