Hi all,

I would like to extend uWSGI by creating a CPython extension module for the libuwsgi.so shared library included in the distribution.

My goal is to use this automatically generated CPython module for extending uWSGI.

I have summarized my current approach here:

https://mail.python.org/pipermail/tutor/2017-December/112475.html

So far, I have tried to use CFFI and pycparser to generate the Python bindings, however CFFI and pycparser doesn't handle C directives like #include and #define.

I also attempted using clang to preprocess the "uwsgi.h" header found in the uWSGI distro with pycparser.parse_file() to generate a AST, however the generated AST object seems incorrect.

Is there any way to reflect a shared library into a CPython module?

I know that using "nm -D libuwsgi.so" I can get a list of available functions for this module. However, I have very little experience with ctypes and CFFI.

Do I need to modify CFFI to allow it to parse a C header with libclang?

I'm guessing CFFI/clang or ctypes should allow me to reflect the shared library, but I'm not sure about which method is the most appropriate.


What do you think?

Sincerely,

Etienne

--
Etienne Robillard
tkad...@yandex.com
https://www.isotopesoftware.ca/

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to