From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Damien Mattei Newsgroups: gmane.lisp.guile.user Subject: Re: interfacing C and guile Date: Fri, 30 Dec 2022 17:52:11 +0100 Message-ID: References: <871qogri9v.fsf@laura> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25448"; mail-complaints-to="usenet@ciao.gmane.io" To: guile-user Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Fri Dec 30 17:52:53 2022 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pBIcm-0006UG-Ti for guile-user@m.gmane-mx.org; Fri, 30 Dec 2022 17:52:52 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pBIcO-00006k-1t; Fri, 30 Dec 2022 11:52:28 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pBIcM-00006M-GZ for guile-user@gnu.org; Fri, 30 Dec 2022 11:52:26 -0500 Original-Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pBIcK-000154-QN for guile-user@gnu.org; Fri, 30 Dec 2022 11:52:26 -0500 Original-Received: by mail-ej1-x62a.google.com with SMTP id x22so52373542ejs.11 for ; Fri, 30 Dec 2022 08:52:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=q8QyqOAO377P8FmQJDonxp7d3x5tLeZKENgT3G/6DDs=; b=g5Wy4xZczukC5lcSfAF069RNh7gCq7XZlu5DN5nTvK/c+iSq8PMa5NR5GpzBiG01fZ DwVcmrOEYRZt2tG39Q/zhKe5tKRYSmS30JumvlI12U8vuWEk9wLz0SS7uOmvJ0/WF6uv hl4G3Mq8qtmXyLizyHd3lCLlHVFgelHUX/HBGrFgyGhKodaQk64DU9C/4jA8Pmj9GOyv uieFyvmlksDIbxnFT8J39nJ5+qmpmoLryxeh+dx6s0nVG6o0YxCYPd+Dm4TtDjZHp5/h OCWMBCGwsihoXptrZtLb2GZwl2iqiQvvgBnDcbIsCZ24UJ6yBbfZdYkRSD9OUZQq69pK dvCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=q8QyqOAO377P8FmQJDonxp7d3x5tLeZKENgT3G/6DDs=; b=qsOYZzQldXOB4Y1jIqZoXjvHGe1EAxEFnVFFvEIgUZUpjWBKOxOVfmneMhS4MYdLL+ goSBkGbNJ/S4SSITQgbDoho/FunZatNMWJv0ScAhGtfDPBm2kOQBbf3nr6IP8Rj7eaT5 8pnTsZ/ihWRbbU0+Sh2LKs1yeW8/8l3wA+uK9Is4wgoxkvoDuvgcmj75gp90vAECS0gz LSM0L6qnsG7WTNHQFWUuQPXYj0D18lSmIMpo/+Zjx9iKw0ab7rBdtN41+SGptxV2xQ5R V7ORLhtIm2dQAIri4zS4PprYmHLhQbHWOFzmiyr3rU3jwJNKkoJXn5udzoysXD4ySAva By3Q== X-Gm-Message-State: AFqh2kqsbIQ1r03q9XNq5JIWZ0vJhH/aGlAuMr+HKWyitiwD8d9HjPtg U65FgvqRnYFnduUmzatLBksDg01XaWTF8dkXrTq1TmB8bHqRlg== X-Google-Smtp-Source: AMrXdXvNAiJOZ9ZR+PsPvfAQ55Hke1IZ7RhHBkbbnxLq25laLPe1BttM8dyhoOQ+KvUr919QTYBV2BYPA3B66x8VfgQ= X-Received: by 2002:a17:906:f857:b0:835:57c9:6424 with SMTP id ks23-20020a170906f85700b0083557c96424mr4084514ejb.529.1672419142590; Fri, 30 Dec 2022 08:52:22 -0800 (PST) In-Reply-To: <871qogri9v.fsf@laura> Received-SPF: pass client-ip=2a00:1450:4864:20::62a; envelope-from=damien.mattei@gmail.com; helo=mail-ej1-x62a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:18808 Archived-At: yes Olivier, i already found this solution a few hours ago digging in the Guile doc: https://www.gnu.org/software/guile/manual/html_node/Void-Pointers-and-Byte-Access.html thanks Damien On Fri, Dec 30, 2022 at 5:03 PM Olivier Dion wrote: > On Fri, 30 Dec 2022, Damien Mattei wrote: > > there was a mistake in my previous post, i wanted to say int cfunc > > (int,int,char *), suggestion answered to use '*: > > > > (define cfunc (foreign-library-function "libguile-cfunc" "cfunc" > > #:return-type int #:arg-types (list int int '*))) > > > > works at this step but gives an error later: > > > > (cfunc 3 27 "toto") > > ice-9/boot-9.scm:1685:16: In procedure raise-exception: > > In procedure foreign-call: Wrong type argument in position 1 (expecting > > POINTER_P): "toto" > > Try (cfunc 3 27 (string->pointer "toto")). It's available in the module > (system foreign). > > -- > Olivier Dion > oldiob.dev >