Re: [Vala] Vala - generates code at runtime



Well, generate classes and load/reload them without recompiling anything would be perfect, but perhaps it's 
not possible in a system like Vala (i mean, without an underlying runtime).
Compiling some plugin/library on-the-fly and reload them is an acceptable solution, but it's not a very 
beautiful one.
The goal is to let a user define new types/classes through a web interface, and having some web services, 
serving as entry points in the system,  able to manipulate (strongly typed search, sort, and so on) these 
user-defined classes/objects without recompiling and restarting the main app.
To avoid the lost of these user-defined objects after an app or system restart, perhaps they can persist on 
the disk using a library like Catalina.


Le 9 févr. 2010 à 15:46, Denis Kuzmenok a écrit :

hi,
the  simpliest way i've found - to make .so libraries, but that is not
the way i wanted to use them, dynamic linking , etc..
you want to have add functions and reload module without recompiling?


Hi all,

I'm wondering what would be the "right" way to generates
code/classes at runtime, and reload it into the running program.
I thought to use the modules/plugin approach
(http://live.gnome.org/Vala/TypeModules) the following way :
- generate code than can be reloaded (plugin code, [ModuleInit]) using some kind of StringBuilder
- flush it to a file
- compile this file either by forking a valac compiler or perhaps
using directly libvala (possible ?)
- reload the resulting plugin binary into the app

There's probably a better way to accomplish this kind of task.

Any idea / suggestion ?

Thanks for helping :)






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]