public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* python header puzzle
@ 2021-01-01 18:33 Marco Atzeri
  2021-01-01 22:30 ` Lemures Lemniscati
  0 siblings, 1 reply; 4+ messages in thread
From: Marco Atzeri @ 2021-01-01 18:33 UTC (permalink / raw)
  To: 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


Regards

Marco

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-01-02  6:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-01 18:33 python header puzzle Marco Atzeri
2021-01-01 22:30 ` Lemures Lemniscati
2021-01-02  2:13   ` Lemures Lemniscati
2021-01-02  6:42     ` Marco Atzeri

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).