Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6bc06ec

Browse files
committed
Bug #794140: cygwin builds do not embed
The embed2.diff patch solves the user's problem by exporting the missing symbols from the Python core so Python can be embedded in another Cygwin application (well, at lest vim).
1 parent 3076559 commit 6bc06ec

4 files changed

Lines changed: 9 additions & 4 deletions

File tree

Include/pyport.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,12 @@ extern double hypot(double, double);
428428
# define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE
429429
# define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE
430430
/* module init functions inside the core need no external linkage */
431-
# define PyMODINIT_FUNC void
431+
/* except for Cygwin to handle embedding (FIXME: BeOS too?) */
432+
# if defined(__CYGWIN__)
433+
# define PyMODINIT_FUNC __declspec(dllexport) void
434+
# else /* __CYGWIN__ */
435+
# define PyMODINIT_FUNC void
436+
# endif /* __CYGWIN__ */
432437
# else /* Py_BUILD_CORE */
433438
/* Building an extension module, or an embedded situation */
434439
/* public Python functions and data are imported */

Modules/gcmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ static PyMethodDef GcMethods[] = {
951951
{NULL, NULL} /* Sentinel */
952952
};
953953

954-
void
954+
PyMODINIT_FUNC
955955
initgc(void)
956956
{
957957
PyObject *m;

Python/import.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2841,7 +2841,7 @@ setint(PyObject *d, char *name, int value)
28412841
return err;
28422842
}
28432843

2844-
void
2844+
PyMODINIT_FUNC
28452845
initimp(void)
28462846
{
28472847
PyObject *m, *d;

Python/marshal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ static PyMethodDef marshal_methods[] = {
875875
{NULL, NULL} /* sentinel */
876876
};
877877

878-
void
878+
PyMODINIT_FUNC
879879
PyMarshal_Init(void)
880880
{
881881
(void) Py_InitModule("marshal", marshal_methods);

0 commit comments

Comments
 (0)