lua-users home
lua-l archive

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


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