Struct with opaque field fails at verify

Issue #8 wontfix
created an issue

The following code {{{


ffi.cdef(""" typedef ... my_time_t; struct my_timespec { my_time_t tv_sec; }; """) ffi.verify("""typedef long my_time_t;""") }}} fails the verify() with a

{{{TypeError: field 'struct my_timespec.tv_sec' has ctype 'struct $my_time_t' of unknown size}}}

This is using a checkout at revision f4b5c451867f, installed via pip install --user

Comments (3)

  1. Armin Rigo
    • changed status to open

    This is a known issue (but still an issue): you cannot use "typedef ... foo" to declare an integer type of unknown size, resolved during verify(). In the demos I had to fish the exact int type that some types are declared to.

  2. Armin Rigo

    Note that you can use "typedef struct { ...; } foo;". This declares a type "foo" whose size is resolved during verify(). But it's more a workaround, and you cannot create or read easily such "foo" objects.

  3. Log in to comment