Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/wapython
Path: blob/main/python/cpython/src/patches/01-main.patch
1067 views
1
--- native/Programs/python.c 2022-09-11 12:23:30.000000000 -0700
2
+++ wasm/Programs/python.c 2022-10-19 10:26:04.000000000 -0700
3
@@ -2,6 +2,11 @@
4
5
#include "Python.h"
6
7
+// This C file, which is defined right now in the dylink nodejs module, adds
8
+// the declaration that make everything extension modules need
9
+// accessible from outside our "python.wasm as a shared library".
10
+#include "libpython.c"
11
+
12
#ifdef MS_WINDOWS
13
int
14
wmain(int argc, wchar_t **argv)
15
@@ -9,6 +14,11 @@
16
return Py_Main(argc, argv);
17
}
18
#else
19
+
20
+// Make the main symbol visible. We do this explicitly since our trick with #define main
21
+// doesn't work with python, due to there being other code that uses main as a struct attribute.
22
+
23
+__attribute__((visibility("default")))
24
int
25
main(int argc, char **argv)
26
{
27
28