Вопрос

I have a Linux application written in C (actually Vala which compiles to C) that loads modules via Glib's GModule 2.0 API. I'm interested in writing a module for it in Python. Is that possible?

Python has GModule bindings via GObject-introspection (PyGI) and I've found documentation for them here but that looks like that's functions for loading modules and not for being loaded as a module.

According to this blog post, in C the loaded module uses G_MODULE_EXPORT to export its functions to the core and the docs I found don't seem to list anything like that.

Это было полезно?

Решение

Yes, it's possible. It would be quite painful to do it directly via GModule, and explanations of everything you would need to do are way beyond a stack overflow answer. Luckily someone has already done the work: libpeas.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top