This is the mail archive of the libffi-discuss@sourceware.org mailing list for the libffi project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Arrays inside structs, passed by value


Hi,

I'm trying to investigate a problem I've found in a Python library
that uses ctypes to call into native code, and causes an abort in
libffi. The problem occurs when calling a function that looks like
this:

    struct array_struct {
        uint8_t data[16];
    }
    void problem_func(struct array_struct arg);

The problem occurs on 64-bit Linux, when the array contains integers
and has a size between 9 and 16 bytes. More details can be found here:

* http://stackoverflow.com/questions/25487928/is-this-the-correct-way-to-pass-a-struct-by-value-in-ctypes
* http://bugs.python.org/issue22273

I'm trying to determine if the problem lies in Python or libffi. My
difficulty here is that I can't find anything in the docs that says
that libffi supports calling such a function, even though I found some
hints in old conversations that there might be a way. Is it possible
to create an ffi_type that describes a struct containing an array? If
so, what is the correct approach?

Best regards,

Weeble.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]