[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: static Lua, shared extensions, platform pain
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Tue, 2 Mar 2010 08:34:28 -0300
> >> Static Lua plus shared extensions will tend to blow up in your face
> >> unless you are very careful.
> >
> > How so? We've all be doing this for years now.
>
> Ah, but you count among the very careful.
But I mean the standard Lua interpreter: it supports static linking of the
Lua core and dynamic linking of user modules out of the box on all major
platforms (magic compilation and link flags are needed, but the Makefile
knows about them).
The user-side issue is how to write Lua libraries as shared libraries
in those platforms; again this may be require magic flags (and the Lua
Makefile does not help here) but nothing really blows in your face. For
the record, the short answer is that in Linux you need to create the .so
with -shared and probably -fPIC (see a recent thread). In Mac OS X, I use
env MACOSX_DEPLOYMENT_TARGET=10.3 $(CC) -bundle -undefined dynamic_lookup
The only real problem we have seen is when people mistakenly link another
copy of the Lua core into their Lua modules: then things may indeed blow up
in your face. Lua 5.2 will have safety mechanisms for that.
If you need to add Lua statically to your app then you need to look at the
Lua Makefiles to figure out what magic flags are needed for this. For gcc
in Linux it's -Wl,-E. You may also need to link with -ldl.
- References:
- Re: please drop whatever you're doing and add -fPIC to all your rockspecs., Pan Shi Zhu
- Re: please drop whatever you're doing and add -fPIC to all your rockspecs., Luiz Henrique de Figueiredo
- Re: please drop whatever you're doing and add -fPIC to all your rockspecs., Pan Shi Zhu
- Re: please drop whatever you're doing and add -fPIC to all your rockspecs., steve donovan
- Re: please drop whatever you're doing and add -fPIC to all your rockspecs., Sean Conner
- Re: static Lua, shared extensions, platform pain, Drake Wilson
- Re: static Lua, shared extensions, platform pain, Luiz Henrique de Figueiredo
- Re: static Lua, shared extensions, platform pain, David Kastrup