Hi Roshan,
On Fri, Sep 18, 2015 at 10:02 AM, Roshan Cherian <[email protected]> wrote:
> _icaltimezonechange is opaque as its in src/libical/icaltimezone.c a c file
> and not in in ical.h. However this struct is required for my purpose.
All structs must be declared in C before you import them into Python.
In this case, the "cheat" to access this structure is the same as if
you wrote C code: you need to give the real C compiler a declaration
of this struct. Then you can import it as you did. (So you need to
write this struct twice.)
ffi.set_source("_ical_cffi_ext",
""" // passed to the real C compiler
#include <libical/ical.h>
struct _icaltimezonechange {
int utc_offset;
int prev_utc_offset;
int year; /**< Actual year, e.g. 2001. */
int month; /**< 1 (Jan) to 12 (Dec). */
int day;
int hour;
int minute;
int second;
int is_daylight;
};
""",
include_dirs=['./include'], # where ical.h is
libraries=['ical'],
library_dirs=['./lib'],) # or a list of libraries to link with
A bientôt,
Armin.
_______________________________________________
pypy-dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-dev