[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Update #4 to Lua 5.1-work3 loadlib cleanups
- From: Mike Pall <mikelu-0412@...>
- Date: Thu, 23 Dec 2004 01:45:01 +0100
Hi,
this is the fourth update to the cumulative loadlib patch. It's available
for download at:
http://lua-users.org/files/wiki_insecure/users/MikePall/lua-5.1-work3-loadlib4.patch
Note: the patch is relative to the original Lua 5.1-work3 distribution.
You have to back out the previous patches or apply it to a fresh copy.
Here are the changes added in this update:
Makefile:
- Remove extraneous $(DLLIB) from EXTRA_LIBS.
[Note: readline support is still broken due to conflicts between luaconf.h
and saconfig.c. I have a patch for this and other issues in the queue.]
include/luaconf.h:
- Remove the special case for LUA_POF under Mac OS X. The underscore is
now prepended in the low-level functions.
src/lib/loadlib.c:
- Allow for loading both bundles and dylibs on Mac OS X.
- Prepend the underscore to the symbol name in the low-level functions
for Mac OS X.
- Use proper error formatting with varargs for Windows.
- Strip non-printing characters from the end of the error string for Windows
(from D. Burgess).
- Dito for Mac OS X.
- Reorganize the code for better separation between the glue code and the
system dependent low-level functions. Split the low-level functions into
ll_load, ll_unload and ll_sym. Move common functionality to the glue code.
Use better names for a few functions.
- loadlib(path) (without a symbol) returns the library userdata.
- Add __index method to the library userdata metatable (this came for free
due to the code reorganization). Resolves symbols and returns lightuserdata
for passing to ffcall, for presence testing, etc.
- Restore the Lua 5.0 behaviour of passing the library handle as an upvalue
to the function created by loadlib() (requested by D. Burgess).
Add the library userdata as a second upvalue for completeness.
- Rephrase comments to match the code.
Bye,
Mike