From: Bruce Korb <bruce.korb@gmail.com>
To: Richard Henderson <rth@redhat.com>
Cc: libffi-discuss@sourceware.org
Subject: Re: pass by value and also snprintf()
Date: Mon, 27 Apr 2015 18:54:00 -0000 [thread overview]
Message-ID: <CAKRnqNLpve9WEF7Am4Rmf8Eq-FZHXAiFBtMSj5AEj10upa7X4g@mail.gmail.com> (raw)
In-Reply-To: <553E7994.5040303@redhat.com>
Hi Richard, THANK YOU!!
> That would be because you're passing buffer and fmt instead of a pointer to
> buffer and fmt. You need to do
>
> char * buffer_p = buffer;
> const char *fmt_p = fmt;
>
> void * values[5] = {
> [0] = &buffer_p,
> [1] = &bufsz,
> [2] = &fmt_p,
> [3] = &sblock,
> [4] = &band };
>
> One of the many peculiarities of the libffi api...
Indeed. Worthy of a BOLD caveat in the docs.
Googling seems to point mostly here:
http://www.atmark-techno.com/~yashi/libffi.html
but it looks like my info doc, so I hope it is up to date. Anyway, it was there
where I also saw that funny comment about altering passed values.
Based on my understanding of C and calling conventions, it seems pretty
impossible for a callee to alter a caller's value when passed by value, even if
one goes through libffi, so what is that comment trying to say? (RE:
ffi_call())
Anyway, again, thank you! Regards, Bruce
prev parent reply other threads:[~2015-04-27 18:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-27 16:59 Bruce Korb
2015-04-27 17:09 ` Richard Henderson
2015-04-27 17:37 ` Bruce Korb
2015-04-27 17:45 ` Bruce Korb
2015-04-27 17:48 ` Bruce Korb
2015-04-27 18:02 ` Richard Henderson
2015-04-27 18:54 ` Bruce Korb [this message]
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=CAKRnqNLpve9WEF7Am4Rmf8Eq-FZHXAiFBtMSj5AEj10upa7X4g@mail.gmail.com \
--to=bruce.korb@gmail.com \
--cc=libffi-discuss@sourceware.org \
--cc=rth@redhat.com \
/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).