From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Matt Wette Newsgroups: gmane.lisp.guile.user Subject: ffi-help: varargs ... Date: Thu, 16 Nov 2017 06:00:35 -0800 Message-ID: <410F22E6-00DC-49BD-910F-6F2E2BFE9C94@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1510840878 15823 195.159.176.226 (16 Nov 2017 14:01:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 16 Nov 2017 14:01:18 +0000 (UTC) To: Guile User Mailing List Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Nov 16 15:01:03 2017 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eFKj0-0003Gk-RP for guile-user@m.gmane.org; Thu, 16 Nov 2017 15:01:03 +0100 Original-Received: from localhost ([::1]:41044 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFKj7-0006TX-Sr for guile-user@m.gmane.org; Thu, 16 Nov 2017 09:01:09 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33366) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFKij-0006TF-E9 for guile-user@gnu.org; Thu, 16 Nov 2017 09:00:46 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFKid-0006gx-LQ for guile-user@gnu.org; Thu, 16 Nov 2017 09:00:45 -0500 Original-Received: from mail-pf0-x22d.google.com ([2607:f8b0:400e:c00::22d]:54690) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eFKid-0006fK-Ce for guile-user@gnu.org; Thu, 16 Nov 2017 09:00:39 -0500 Original-Received: by mail-pf0-x22d.google.com with SMTP id n89so19680294pfk.11 for ; Thu, 16 Nov 2017 06:00:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:mime-version:subject:message-id:date:to; bh=5zqvf6Fyc+xKOzpNKWBEDsZU5M0KX9L5A05No29Jeqw=; b=DPyj8i8FfKAHsjrNRsr20QVPSoCkqdPG2i4KYXgeLDY76c4w1VBqUREMIVn7vIXtnR pn1tQTyDAVQXVVjJEFo0VxZRmmpq+9x6l639I/P/BE3IdVk5+aOLPSuZsSwd5hHDr5da LEdlzqLE+t+ik4zJ6zQPf9YEQcYulu+2bs8Vj+4svC8xOom4wnvx7UZRirLFFRynnsNu Gda3SOcbBqZgd/Q86V23W13z4GKVb2cVypOELWKqj6Sry5ZbVzIZ91NRCX2+SEadczXu BDiTtqYhT27gUIIaP2Y8iS3YAIMn1NV6PhLE2FbSRBFV0umV9V3C+BLlACi+EhNoIBtn hGqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:subject:message-id:date:to; bh=5zqvf6Fyc+xKOzpNKWBEDsZU5M0KX9L5A05No29Jeqw=; b=PEmkzjNaGVFfMvNnBMTX8B2lcNXPYpZ7yAHppxncTBSTbtqIKiE9/AbYpbNu9k4AI/ Ttn4uWlCtDIG77sQRKZlKkvh3bAWN3iJ3jXHOS7IOXpwzI2aFt/xXpLU0uEyQOR+h8jS wUT2KuSNM+Ce0nbYB+5RIcj25j4KruzI5CJI0o0TPszLvEugExPP/NcJIDbvBAHjLty8 owPPsLVfXWsrjwrzUckw6Yb6VLP0tKBtIcfXVr4yBaeLYPYisnshA5Lt7BanQCCwqC1J BP0YMFUwRQYjZYmEtRKEbN3CYLGC8+RBLGs1LQBKxBdrkFgiR2fQ95Tw9mTGg3T8QoBe HTFw== X-Gm-Message-State: AJaThX67uxgLVmPYZPWCDm7Ha1NSS+PRnptwguNYJ2T+3Tx/oqLw6F1K ghZmZ8ASGQ6X4LS1BsbY8bq4cxvs X-Google-Smtp-Source: AGs4zMbJDpBLf2PtYSEc1gsQVqDeiMmI5LnAkbQtd4wUAPiWIgNhBmhUi4dXROmjeyDAz86Sjt1/ag== X-Received: by 10.99.161.25 with SMTP id b25mr1730154pgf.283.1510840837731; Thu, 16 Nov 2017 06:00:37 -0800 (PST) Original-Received: from nautilus.championbroadband.com (216-165-229-229.championbroadband.com. [216.165.229.229]) by smtp.gmail.com with ESMTPSA id u6sm2697897pgo.9.2017.11.16.06.00.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Nov 2017 06:00:37 -0800 (PST) X-Mailer: Apple Mail (2.3273) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::22d X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:14265 Archived-At: I am working on a ffi-helper (FH): a program that will read in a C dot-h = file=20 and generate a Guile dot-scm file which defines a module to provide = hooks into the associated C library.=20 I have support for functions which use varargs working. Users must cast = undeclared arguments: mwette$ cat tryme.h int printf(char *fmt, ...); mwette$ cat tryme.ffi (define-ffi-module (tryme) #:include '("tryme.h") #:library '("libz")) ;; need dummy mwette$ guild compile-ffi tryme.ffi wrote `tryme.scm' mwette$ guild compile tryme.scm wrote `/..../tryme.scm.go' mwette$ guile scheme@(guile-user)> (use-modules (tryme)) scheme@(guile-user)> (use-modules (system ffi-help-rt)) scheme@(guile-user)> (use-modules (system foreign)) scheme@(guile-user)> (printf "Hello, for the %d-th time\n" (fh-cast int = 10)) Hello, for the 10-th time $1 =3D 26 scheme@(guile-user)>=20