I was trying to get IupLua built for some of the new platforms I’m
working on, but I am getting blocked by a dependency problem. So I
wanted to clarify how they are supposed to be built.

I had assumed they were built as shared loadable modules and not
regular dynamic libraries. (The distinction between the two is
important because some platforms make a strong distinction and have
consequences like what I’m facing.) But maybe my assumption is wrong…

While trying to build iupweblua, I discovered there is a dependency on
the C symbol iuplua_call in iuplua. If building modules, this
dependency is problematic because I can’t directly link again iuplua
in a lot of cases.

For example, on Mac, I need to use the additional flags
-flat_namespace -undefined suppress to remove the compile time issue.

http://lua-users.org/wiki/BuildingModules
gcc -bundle -flat_namespace -undefined suppress -o module.so module.o

But there is still a runtime issue because when the iupluaweb module
gets loaded, it fails because it still cannot find the iuplua_call
symbol (even when the iuplua module was required before it). This is
because Lua by default calls dlopen with RTLD_LOCAL instead of
RTLD_GLOBAL.

http://lua-users.org/lists/lua-l/2015-05/msg00297.html

This means the symbols that got loaded when loading iuplua are not
globally visible for iupluaweb to automatically pick up, which is why
the module fails to load. (And this problem is true on all the Unices,
not just Mac as far as I know.)

Does IupLua do something special to get around this? (I heard
something about a flag with package.loadlib in Lua 5.2 to force
RTLD_GLOBAL.)


But then for Windows/Visual Studio, this is even a bigger head
scratcher for me because I don’t think there is any compiler flag to
skip past the link dependency. Furthermore, when you build a module
instead of a library for Windows, you don’t get an explicit .lib that
you can link to, even if you wanted to try to explicitly link against
it.


So maybe my assumption is wrong and everything should be built as
dynamic libraries? This would allow iupluaweb to link against iuplua.
But this means your main app must always explicitly link against
iuplua/iupluaweb, etc. And I think this has negative repercussions for
standalone Lua interpreters/apps that hope to load iuplua* modules
without having explicit knowledge of them (link beforehand) since some
platforms make stronger distinctions between loadable modules and
dynamic libraries.


FYI, I’m testing against Lua 5.3.

Thanks,
Eric

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to