How do I make my program extendable?

BlitzMax Forums/BlitzMax Beginners Area/How do I make my program extendable?

ImaginaryHuman(Posted 2004) [#1]
Hi folks. I have a pretty strange project that I'm dreaming up and I'm wondering how I might go about allowing functionality to be added to the software while it is being executed? I thought perhaps if I use methods, I can include a method inside a type and create a new instance of the type, so that effectively a new piece of code is added. I'm sure that must work, but of course the code has to be defined at compilation time so that it can be converted into machine code for whatever platform it is compiled on. So that doesn't exactly make it dynamic.

What ways can I dynamically add new functionality to a program while it is running?

I guess another option is to use some kind of script language like lua or arexx or whatever, which the system would then have to interpret. But I'm trying to get rid of the need for interpretation - it's a big overhead. A dynamic compiler would be nice but even if the Blitz Research folk allowed the BlitzMax compiler to be called within a program it would still be a long and slow compilation, not to mention the copyrighted compiler.

Any other suggestions?


FlameDuck(Posted 2004) [#2]
I'm not sure BlitzMAX directly supports runtime linking (or runtime reflection for that matter).

However, since BlitzMAX AFAIK uses ld, the GNU linker, you could write a script that linked your final binary at runtime, and thus you could provide some sort of pseudo run-time linkage allowing for better plug-in integration.

Dunno. Worth a shot I reckon.


skn3(Posted 2004) [#3]
You could use LUA and have plugins written in that.


ImaginaryHuman(Posted 2004) [#4]
Is Lua fast? ie for realtime use in a 2D game?


jhague(Posted 2004) [#5]
Lua is fast enough, especially if you consider that interpreted languages were fast enough for games back in the day of the 66MHz Pentium. Don't worry about performance here unless you find it's a bottleneck.

It does seem to me that Lua might be overkill in this case, though. It's a whole new language to learn and understand the details of. You need to better define how you want your software to be extended,.


ImaginaryHuman(Posted 2004) [#6]
Hmm, well, not totally out of the question.

Any other ways to extend a program? It would be great if BlitzMax had some kind of plugin support at least.

Short or writing my own compiler (sounds like a heck of a task) I don't see any other options.


Hotcakes(Posted 2004) [#7]
I wish BVM2 would be released for Max, but since K doesn't even own Max yet it's looking doubtful =[ I would much prefer that to Lua...