lua-users home
lua-l archive

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

> Here is the makefile I wrote to build a static library (liblfs.a) as you
> sugested :
> Is that ok?
	I think it is ok, but I don't know the option '-Os'.

> >Then, the static library should
> >be used to build the launcher executable,
> >
> Do I only have to add my newly created liblfs.a to the objects when
> linking the launcher?
	Yes, but you'll have to add code to _cgi.c.  See next paragraph.

> >BUT you'll have to call the
> >initialization function (luaopen_lfs) or register it at `package.preload'
> >table (this way, require() will find it when trying to load the package).
> >
> >
> I've no idea of how to add luaopen_lfs in 'package.preload'... it sounds
> like chinese to me :-(
	Open _cgi.c and search for 'add your libraries here'.  You
should add a line:

    {"lfs", luaopen_lfs},

	before the {NULL, NULL}.  This will add the library to the
launcher.  In cgi.lua (or t_cgi.lua) you'll have to comment the line

require"lfs" => --require"lfs"

	Because the library is already there and it is not registered
in package.preload.

	Look, this "how-to" is not the best way to solve the problem
but I'll need some time to do it.  I think you should try the above hints
and maybe we can add a rule to make a static version.