From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 59615 invoked by alias); 27 Apr 2015 16:59:44 -0000 Mailing-List: contact libffi-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libffi-discuss-owner@sourceware.org Received: (qmail 59605 invoked by uid 89); 27 Apr 2015 16:59:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f170.google.com Received: from mail-wi0-f170.google.com (HELO mail-wi0-f170.google.com) (209.85.212.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 27 Apr 2015 16:59:42 +0000 Received: by wiax7 with SMTP id x7so88895768wia.0 for ; Mon, 27 Apr 2015 09:59:39 -0700 (PDT) X-Received: by 10.180.92.228 with SMTP id cp4mr22002730wib.62.1430153979029; Mon, 27 Apr 2015 09:59:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.33.135 with HTTP; Mon, 27 Apr 2015 09:59:18 -0700 (PDT) From: Bruce Korb Date: Mon, 27 Apr 2015 16:59:00 -0000 Message-ID: Subject: pass by value and also snprintf() To: libffi-discuss@sourceware.org Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2015/txt/msg00064.txt.bz2 I read this paragraph and have a question: avalues is a vector of void * pointers that point to the memory locations holding the argument values for a call. If cif declares that the function has no arguments (i.e., nargs was 0), then avalues is ignored. Note that argument values may be modified by the callee (for instance, structs passed by value); the burden of copying pass-by-value arguments is placed on the caller. If libffi moves the values into places where the callee can find them, it would be interesting to know how the callee can modify the original value. That value cannot be at the place pointed to by the "avalues" array of pointers. - - - - - Anyway, I believe in my last missive, I had all the arguments for snprintf() set up correctly, yet snprintf faulted anyway. Since GDB showed everything as I would expect and since I cannot make much sense of what the ffi_call_unix64 is doing, I hope there is an obvious answer to what I am missing: https://sourceware.org/ml/libffi-discuss/2015/msg00063.html Thank you in advance! Regards, Bruce