public inbox for libffi-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Weeble <clockworksaint@gmail.com>
To: libffi-discuss@sourceware.org
Subject: Arrays inside structs, passed by value
Date: Thu, 28 Aug 2014 16:39:00 -0000	[thread overview]
Message-ID: <CACBComEduUb3Hyn7crN_dSxJsar4wt0FEBmwjg6mYjdDzyDqMg@mail.gmail.com> (raw)

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.

                 reply	other threads:[~2014-08-28 16:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACBComEduUb3Hyn7crN_dSxJsar4wt0FEBmwjg6mYjdDzyDqMg@mail.gmail.com \
    --to=clockworksaint@gmail.com \
    --cc=libffi-discuss@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).