Shnatsel
Shnatsel

Reputation: 4209

Can I load Python scripts as Glib GModules?

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.

Upvotes: 1

Views: 200

Answers (1)

nemequ
nemequ

Reputation: 17492

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.

Upvotes: 3

Related Questions