[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Storing Lua code in a C library
- From: steve donovan <steve.j.donovan@...>
- Date: Sat, 26 May 2012 10:22:36 +0200
On Sat, May 26, 2012 at 9:11 AM, Sean Conner <sean@conman.org> wrote:
> If the compiler complains about -fpic, only then use -fPIC.
I tend to use lake for simple builds like this
lua$ lake -lua foo.c
gcc -c -O1 -Wall -I/usr/include/lua5.1 -fpic -MMD foo.c
foo.c: In function ‘luaopen_foo’:
foo.c:18: warning: value computed is not used
gcc foo.o -Wl,-s -shared -o foo.so
That warning is instructive - we should really do something with the
result of luaL_dostring!
The -MMD is not essential, it's just lake tracking include files, and
you don't have to strip (-Wl,-s)
OS X is ... different
Steve $ lake -lua foo.c
gcc -c -O1 -Wall -I/Users/Steve/dev/lua/src/lua-5.1.4/src -fPIC -MMD foo.c
gcc foo.o -dynamiclib -undefined dynamic_lookup -o foo.so
steve d.