From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Amirouche Newsgroups: gmane.lisp.guile.user Subject: Re: ffi-helper: looking for C libraries to try Date: Sat, 15 Jul 2017 02:55:42 +0200 Message-ID: <3f26923d-3f24-9e90-6daa-b8c2ed26fa1e@hypermove.net> References: <22E467C6-8BCD-43B6-90B3-CFC43FC8799E@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1500080106 16276 195.159.176.226 (15 Jul 2017 00:55:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 15 Jul 2017 00:55:06 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sat Jul 15 02:54:58 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 1dWBME-0003SV-US for guile-user@m.gmane.org; Sat, 15 Jul 2017 02:54:55 +0200 Original-Received: from localhost ([::1]:40339 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dWBMH-0008DH-0g for guile-user@m.gmane.org; Fri, 14 Jul 2017 20:54:57 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33968) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dWBLv-0008DC-PA for guile-user@gnu.org; Fri, 14 Jul 2017 20:54:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dWBLs-0005eh-NT for guile-user@gnu.org; Fri, 14 Jul 2017 20:54:35 -0400 Original-Received: from relay2-d.mail.gandi.net ([217.70.183.194]:49462) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dWBLs-0005eI-Gj for guile-user@gnu.org; Fri, 14 Jul 2017 20:54:32 -0400 Original-Received: from [IPv6:2a01:e35:2ef3:d930:551b:e2e0:37f6:f2e7] (unknown [IPv6:2a01:e35:2ef3:d930:551b:e2e0:37f6:f2e7]) (Authenticated sender: amirouche@hypermove.net) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id E6966C5A44 for ; Sat, 15 Jul 2017 02:54:30 +0200 (CEST) In-Reply-To: <22E467C6-8BCD-43B6-90B3-CFC43FC8799E@gmail.com> Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.70.183.194 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:13923 Archived-At: Le 15/07/2017 à 01:17, Matt Wette a écrit : > Hi All, > > I am working on a ffi-helper: a program that will read in a C dot-h file and generate a Guile dot-scm file which > defines a module to provide hooks into the associated C library. My goal is to have something to release ~Oct 2017. > > I am looking for suggestions for libraries (w/ includes of course) to use as test cases to flush-out and debug my code. I have worked on cairo and now working on gdbm. I tried git2 but those headers are too broken. > > If you have suggestions for test cases, please post. They should be commonly used. > (I use MacPorts and would want them to be installable in that context.) > > Status: > > I have now been able to compile-ffi the following on my Mac. I’m sure bugs remain. > > (define-ffi-module (cairo cairo) > #:pkg-config "cairo" > #:include '(“cairo.h" "cairo-pdf.h" "cairo-svg.h") > > ;; the following are bent pipe to scm-module > #:export (make-cairo-unit-matrix) > ) > > (define (make-cairo-unit-matrix) > (make-cairo_matrix_t #(1.0 0.0 0.0 1.0 0.0 0.0))) > > I convert the above “cairo.ffi” file to “cairo.scm” using the following command > > mwette$ guild compile-ffi cairo/cairo.ffi Can you provide guidance regarding how to run compile-ffi, here what I've done so far: $ git clone https://git.savannah.nongnu.org/git/nyacc.git $ cd nyacc $ git checkout c99dev $ cd examples/nyacc/lang/c99 $ source env.sh Then: $ guild compile-ffi cairo/cairo.ffi ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0 ;;; or pass the --no-auto-compile argument to disable. ;;; compiling /home/amirouche/.guix-profile/bin/guild ;;; compiled /home/amirouche/.cache/guile/ccache/2.2-LE-8-3.A/gnu/store/1pzfigry5bnh3n146w0ib77vkd2g6jdc-guile-2.2.2/bin/guild.go guild: unknown script "compile-ffi" Try `guild help' for more information. I have guile-bytestructures Thanks!