Re: [python-cffi] cffi.FFI.cdef and implicit function declarations

Armin Rigo <[email protected]> Wed, 8 Feb 2023 13:18:13 +0100
Newsgroups dev.linux.lists.c-std-porting
Message-ID <CAMSv6X1SYtqD1vHsom8s0xCbqF-K_9EJV4htti0mL9RyqFiyZQ@mail.gmail.com>
Hi again,

On Wed, 8 Feb 2023 at 13:12, Armin Rigo <[email protected]> wrote:
> make the declared functions available to the C code.  A typical usage
> is to say ffi.verify('#include <something.h>').  If you are getting an
> "implicit function" warning from the C compiler, then this was not
> done correctly.

...In other words, if changes to the C compiler replaces these
warnings with errors, and this breaks old existing code, then that old
code was broken in the first place for relying on that feature.  I
don't think there is something to say about that specifically for
CFFI's old verify() API.  I think the problem is the same as people will
encounter with old, manually-written C code which was broken the same way.
The fix is to add the missing #include in both cases.  For ffi.verify()
it is added in the first argument, which is copied into the generated C code.



Armin Rigo