lua-users home
lua-l archive

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


On Wed, Jul 26, 2017 at 9:18 AM, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
>> > Can you describe a simple test for dynamic library support?
>>
>> Save this file to dummy.c:
>>
>> [...]
>
> I think there is a simpler way. Just run the following:
>
> $ lua
>> = package.loadlib("a", "b")
>
> If the error message is something about not finding "a" (e.g.,
> "a: cannot open shared object file"), then you have DLL support.
> Otherwise, the error message is something like "dynamic libraries
> not enabled".

Thank you, this test was excellent. LUA_USE_DLOPEN is required to load
a dynamic library in Lua on FreeBSD (12-current). However,
LUA_USE_READLINE seems to have no effect either way. My target was:

freebsd:
        $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN
-I/usr/local/include" SYSLIBS="-L/usr/local/lib -Wl,-E -lreadline"
CC=cc


With -DLUA_USE_DLOPEN:

russellh@prescott:/tmp/lua-5.3.4/src% ./lua
Lua 5.3.4  Copyright (C) 1994-2017 Lua.org, PUC-Rio
> = package.loadlib("a", "b")
nil     Shared object "a" not found, required by "lua"  open


Without:

russellh@prescott:/tmp/lua-5.3.4/src% ./lua
Lua 5.3.4  Copyright (C) 1994-2017 Lua.org, PUC-Rio
> =package.loadlib("a","b")
nil     dynamic libraries not enabled; check your Lua installation      absent

Russ