GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — python/static_submodules-test.c at trunk · python-emscripten/python

Expand file tree

/

static_submodules-test.c

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
42 lines (31 loc) · 1.14 KB
/

static_submodules-test.c

Copy path

File metadata and controls

42 lines (31 loc) · 1.14 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <Python.h>
#include <stdio.h>
PyMODINIT_FUNC inittestmod_testsubmod(void); /*proto*/
int main(void) {
// Trace modules loading
//setenv("PYTHONVERBOSE", "1", 0);
// Load additional modules installed relative to current directory
setenv("PYTHONPATH", ".", 0);
Py_InitializeEx(0);
//inittestmod_testsubmod();
static struct _inittab builtins[] = {
{"testmod.testsubmod", inittestmod_testsubmod},
{NULL, NULL}
};
PyImport_ExtendInittab(builtins);
PyRun_SimpleString("import testmod.testsubmod; testmod.testsubmod.myputs()");
Py_Finalize();
}
/*
cat <<'EOF' > testmod/testsubmod.pyx
cdef extern from "stdio.h":
int puts(const char *s);
def myputs():
puts("\n\nHELLOOOOOOOOOO\n\n");
EOF
cython testmod/testsubmod.pyx
sed -i -e 's|Py_InitModule4("\([^"]\+\)"|Py_InitModule4("testmod.\1"|' \
-e 's|^__Pyx_PyMODINIT_FUNC init|__Pyx_PyMODINIT_FUNC inittestmod_|' testmod/testsubmod.c
gcc -I../../Include -I.. testmod/testsubmod.c main.c ../libpython2.7.a -lm -ldl -lutil && ./a.out
See also https://mdqinc.com/blog/2011/08/statically-linking-python-with-cython-generated-modules-and-packages/
*/
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.