Open
Description
As I understand it, PyInit_
is a CPython thing.
The code here:
Line 59 in 2b81170
if sys.platform == 'win32':
if sys.version_info >= (3,):
prefix = 'PyInit_'
else:
prefix = 'init'
seems to always generate a .def
file which will cause a linker failure on trying to export the non-existing PyInit_ symbol.
I would expect a _cffi_pypyinit_
prefix for PyPy.
This makes CFFI unusable on Windows / PyPy platforms, and is quite a difficult problem to track down.
(e.g., https://github.com/ecere/pyecrt/actions/runs/14982225821/job/42088776136#step:7:3509)
CFFI extension code is generated as such:
#ifdef PYPY_VERSION
PyMODINIT_FUNC
_cffi_pypyinit_myext(const void *p[])
{
p[0] = (const void *)0x2601;
p[1] = &_cffi_type_context;
#if PY_MAJOR_VERSION >= 3
return NULL;
#endif
}
# ifdef _MSC_VER
PyMODINIT_FUNC
# if PY_MAJOR_VERSION >= 3
PyInit_myext(void) { return NULL; }
# else
initmyext(void) { }
# endif
# endif
#elif PY_MAJOR_VERSION >= 3
PyMODINIT_FUNC
PyInit_myext(void)
{
return _cffi_init("myext", 0x2601, &_cffi_type_context);
}
#else
PyMODINIT_FUNC
initmyext(void)
{
_cffi_init("myext", 0x2601, &_cffi_type_context);
}
#endif
Metadata
Metadata
Assignees
Labels
No labels