Can this be done? (loading extensions from dlls / so's at runti me)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Can this be done? (loading extensions from dlls / so's at runti me)

Asko Kauppi-2
Hi, all!

I'm new to Lua and just evaluating it for the first project. I understand
the concept is to "embed" it within a stand-alone application and this is
what I'm doing. However - the more intuitive model for this case would be
another road, as follows:

1. I'd use a generic "lua interpreter" (like the one provided in the
package)

2. In the lua scripts run through that interpreter, they'd say "load
my_extensions.so" (or something like that), dynamically linking to the
functions etc. resources within the ".so".

This isn't possible with the current implementation, right?

If I do extensions, I have to complain the full lua engine into the app as
well. This might lead to situations where there are several engines
(probably of different version) on a system at once, each for a separate
task and with its own extensions. Somehow, I feel more at home if I had one
language engine and "libraries" (althoug implemented in C) for that.

Does anyone share these ideas and has this been discussed already?

- Asko

Btw, the language itself I like a _lot_ - thanks for the authors!!!   :)

--
Asko Kauppi
Flextronics Design Finland
Box 23, 39201 Kyröskoski, Finland
www.flextronics.com 
PGP: 8348 2AE1 CEDC C81A 2255  2439 E4C8 7308 825E 32C3


###########################################
This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.


Reply | Threaded
Open this post in threaded view
|

Re: Can this be done? (loading extensions from dlls / so's at runti me)

Tomas Guisasola Gorham-2
> 2. In the lua scripts run through that interpreter, they'd say "load
> my_extensions.so" (or something like that), dynamically linking to the
> functions etc. resources within the ".so".
> 
> This isn't possible with the current implementation, right?
> 
> If I do extensions, I have to complain the full lua engine into the app as
> well. This might lead to situations where there are several engines
> (probably of different version) on a system at once, each for a separate
> task and with its own extensions. Somehow, I feel more at home if I had one
> language engine and "libraries" (althoug implemented in C) for that.
> 
> Does anyone share these ideas and has this been discussed already?
	I've made a package with some libraries and a Makefile
that modifies the distributed Lua interpreter to add the capability
of loading dynamic libraries.  I've only tested it on Linux, but I
think it runs on any Unix...
	I've been using it for exactly what you want: scripts
that need some C libraries loaded dynamically.  The package includes
LuaSQL, LuaSocket, MD5 and Poslib.  I can send you a copy if you ask me.
	On the other hand I don't know exactly if the method I've
implemented will be compatible with the method adopted in the new
version 5.0.  So, maybe you would prefer to wait for it.

	Tomas