On 1 May 2013 02:11, Sean Conner <[email protected]> wrote:
> It was thus said that the Great Hisham once stated:
>> On 30 April 2013 00:01, Sean Conner <[email protected]> wrote:
>> >
>> >   I'm afraid I'm the only one that wants this, but I would really love the
>> > ability to specify C99 when compiling Lua modules.  All the Lua modules 
>> > I've
>> > written in C use C99 features (some more, some less).  I rationalize this
>> > because
>> >
>> >         1. C99 is now fourteen years old
>> >         2. I started with C89 in 1991!  I think I can safely use a standard
>> >            that is fourteen years old by now! [3]
>> >
>> >   But unfortunately, the supoprt for C99 in Luarocks is ... possible, but 
>> > it
>> > still has issues.
>>
>> I hear you, and C99 support was an unfortunate omission in the
>> rockspec format. It will certainly be fixed in the future. In the
>> meantime, there's an ugly gcc-specific hack that works:
>>
>> defines = { "dummy -std=c99" }
>>
>> This expands to `-Ddummy -std=c99` in the compilation lines and does
>> what you expect...
>
>   I hate to say that it didn't work.

It didn't? I just tested it here and it seems to pass the flag. Just
to be clear, this 'defines' table is supposed to be inside each
module's entry in a builtin-type build section, like this:

build = {
   type = "builtin",
   modules = {
      foo = {
         sources = { "foo.c" },
         defines = { "dummy -std=c99" },
      },
      re = "re.lua"
   }
}

Running that, I get the following line here:

gcc -O2 -fPIC -I/Programs/Lua/Current/include -c foo.c -o foo.o -Ddummy -std=c99

-- Hisham
http://hisham.hm/

------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
Luarocks-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luarocks-developers

Reply via email to