[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: How to add users libraries
- From: Keith Wiles <kwiles@...>
- Date: Thu, 01 Dec 2005 11:28:15 -0600
Luiz Henrique de Figueiredo wrote:
I guess having to copy and modify the linit.c file is one method, but it
is not as clean as it could be for the developer. It is fast and easy,
but it requires the developer to modify files in the standard release.
Was the intent for the developer to copy and/or modify linit.c for each
project which required more or different libs?
Yes, if the user libraries are static. If you use lua.c then all you
need to do is to link lua.o with your linit.o and of course with
lualib.a. If you use your own main, then link with your linit.o and call
luaL_openlibs (perhaps from inside a lua_cpcall, like lua.c does).
That is why linit.c is a separate module, not a part of lua.c as it used to be.
In most embedded applications Lua would be a very small, but very
central part of the whole project. Some large projects have restrictions
on editing and/or changing source code for common components. Some
devices require the system to be certified, which means you may not be
able to alter the source after it has been certified and the developer
would only get archives of the component.
To make a long story short (which I have failed already :-) is Lua needs
to be developer friendly in the areas of source code control and how
they effect the content such as which libs are linked into the image. It
would be better if Lua was able to be compiled as an archive and the
developer could alter the behavior externally without editing the source
code or having to copy files.
One of the methods I used was the global 'userLibHook' pointer to allow
the developer to add his own hooks without having to alter a single line
of code in the core component. This is only one method which I have used
in the past, but I am sure others could create a better solution.
I want Lua to be developer friendly and be able to be upgraded in a
large project or multiple projects without any modification needing to
be done to Lua by developer. Each time the developer alters core code in
an external component he starts to own that code and can be difficult to
upgrade or it takes time away from the real areas of the code.
I hope I have not upset anyone and I am sorry for the bandwidth usage.