jderobot meets Python

jderobot is now able to load Python code with a new command “aload” allowing any kind of script to be loaded and executed inside an embedded interpreter. Thank you to the Python/C API this task has been easier. Most of the code to do it can be found here.
Now to load a Python script is as simple as:
jderobot $> aload hello.py
Loading hello.py…
Hello world!
jderobot $>

Future jderobot4.4 will be able to load schemas programmed in Python through Swig wrappers. Almost all the API will be available within Python and schemas will be able to “talk” to other ones, no matter their programming language.

Go to Source

jde, jderobot 1 Comment

Written by:

Autoloading a module

Some time ago I made some tests on dlopened modules, trying to find some simple autoloading mechanisms. The usual way we were using dlopen was followed by a dlsym calls collection. This way you can get functions defined inside the module. But this forces the application to know the searched symbols names.

An easy way to avoid this is letting the module to register itself, providing some registering mechanism, on loading time. So the only requirement is some kind of constructor called inmediatelly after dlopen call. gcc function atributes in C and variable initialization through functions in C++ are really easy ways to get this pourpouse.

More info can be found here.

jde, jderobot No Comments

Written by: