On 09/09/15 18:04, Gavin Wraith wrote:
Thanks for the advice. The / prefix should be no problem as internally
Lua uses separate environment variables for paths for dynamically
loaded Lua and dynamically loaded C modules.

The GCCSDK shared library system doesn't support using dlopen from a
statically linked executable.

Oh dear. Lua is usually built as a core with statically linked main
libraries plus dynamically linked extra libraries. The loader is
in the main library "loadlib" and if the compiler flag LUA_USE_DLOPEN
is defined it uses "dlfcn" in the GNU C library to implement dlopen.
Do I take it that GCC's implementation of dlfcn works with the
SOManager?

Yes. We have a dynamic linker and libdl just as most (all?) Unix type
platforms do. But these work on a per program basis; they have no
knowledge of other programs. That's where SOManager comes in. It
controls the loading of shared libraries and keeps track of which
programs are using them so that there's only ever one instance of
a library in memory no matter how many programs are linked to it.
When the dynamic linker needs a library to satisfy a program's
dependency, it asks SOManager to load the library if it's not already
present and then give it a new copy of its R/W segment.

It ought to be possible to make "loadlib" dynamically loadable instead
of statically, if that is what is needed.

I'm not clear on if you've had to put a lot of work into supporting
plugins previously or whether your using a solution that comes from the
Lua source.
If the original source has support for dlopen, then this should work
with some minor changes to plugin pathnames.
Having said that, I may be under estimating the complexity of Lua's
requirements. It's just occurred to me that "loadlib" is actually
written in Lua and not C? I assume though that there is a C/C++
based runtime interpreter that handles the dynamic loading of libraries?

Lee.


_______________________________________________
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK

Reply via email to