Re: `invalid C type' problem

  • From: Konstantin Olkhovskiy <lupus@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Tue, 10 Sep 2013 20:44:51 +0400

2013/9/10 Mike Pall <mike-1309@xxxxxxxxxx>
>
> Well, since a static variable declaration should never be in a
> regular header file, nor should such a declaration be passed to
> ffi.cdef().
>

Can you elaborate your point please? `Never' is quite a strict word.
The header file I've got with this issue is [1]. Yes, the author could
use a define for that, but he did not. Given that khash is said to be
the most performant implementation of hash table in C, the reason
for that might be performance.

OTOH inline functions are quite prevalent in header files, so
> ignoring them seems to be the better choice.
>

We are processing header files in automated fashion with `gcc -E' and
some Perl magic. Having to add extra workarounds with Perl regexp is
inconvenient and error-prone. LuaJIT already does the C code parsing
and also does ignore legal(standard wise) C constructs that do not make
any sense to FFI.

Is it too much work to add ignore for static variable declarations? LuaJIT
is a better place for that than client cdef generator, especially if you
have
plans on C preprocessor integration.

[1] https://github.com/attractivechaos/klib/blob/master/khash.h
-- 
Regards,
Konstantin

Other related posts: