On 12 May 2015 at 17:28, Cosmin Apreutesei <cosmin.apreutesei@xxxxxxxxx> wrote:
Hi again Stefano,
I can give you some feedback regarding the directory layout. I hope
you'll find it useful.
TL;DR: Loading dll depdendencies from separate directories is hard --
much easier to have them all in one directory: the directory of the
exe. Doing otherwise opens up a can of worms that affects many design
decisions when making a package manager.
The long version (sorry for the length but it's complicated):
...
It is very tempting to choose the modular directory layout: it makes
it much easier to write the package manager, it makes browsing the
tree pleasant, and your filesystem API maps cleanly to your package
manager API (removing a package is `rm -rf <package>`, nice!). But
this also means having to modify the runtime to support this new
layout. And some runtimes are less forgiving then others. Let's see
the check list:
* loading Lua modules: just add a custom loader to package.loaders (check!)
* loading Lua/C modules: same here (check!)
* loading dlls: patch ffi.load (clean) or use explicit relative
paths in all invocations (not so clean) (check!)
* loading dependencies of said dlls (or said Lua/C modules)...
here's where it gets ugly: you could use SetDLLDirectory /
LD_LIBRARY_PATH but 1) you would have to know in advance all the
binary dependencies of all your modules (no package database you
say?); 2) you might exceed the max. allowed length for these path
lists with enough modules; 3) it might get slow.