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 14:48:35 +0100 Message-ID: References: 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="15130"; 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 14:49:43 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 1pBFlV-0003oF-UB for guile-user@m.gmane-mx.org; Fri, 30 Dec 2022 14:49:41 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pBFkr-0006OZ-V8; Fri, 30 Dec 2022 08:49:01 -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 1pBFkh-0006OE-DD for guile-user@gnu.org; Fri, 30 Dec 2022 08:48:57 -0500 Original-Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pBFkf-0002Gp-Es for guile-user@gnu.org; Fri, 30 Dec 2022 08:48:51 -0500 Original-Received: by mail-ed1-x52b.google.com with SMTP id b88so23276357edf.6 for ; Fri, 30 Dec 2022 05:48:48 -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=tKwDbbxFWieLJHbObewL6z9mqeCCu1Bb73J/VsKZ03E=; b=FPqb4TLikwEaBhlwAbigK2b60rO1KEDm209GTleYCwpO1PP205khJ1GbFjssvP2r2L 2tstj2F/AIODSPT9gZ4en1XtxmQs/F3pN4d/BH/T6qpdwpxL7aGmwIa5DIugHrUigqTF IglH3A8DpPJ2/jjAqYarljGyYPD7QMuq2wX8AUzQNj+WP1ioHGzTztOovP9J9mH3gccz gr+6p16WtXbemESOVv+je2gic5n+R5LC6ctRc+JLA5w8m2L6zEEVY1vEZK2w/QKJ+KLA 1RXrqpJQzyGe6C0yhXtZHDna/WdR0obIIOF3RQsChhWT8VNYqimbl/cv0znt/rhKO6m4 mC2g== 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=tKwDbbxFWieLJHbObewL6z9mqeCCu1Bb73J/VsKZ03E=; b=hwUBC9O6DboXkfU3dAFPUh9lZ1mlckMYpuELTbKUqZ1liPK+N2fB+rRviwTs3L8e2Z H0WsJSmG12JStJAc0e5NXSk4qYOX9hDAtktdvd4OD0b86QD68uYqk1esTRHcIGMGlELH +QchQCNXAQZPmfykRUzKHHQ0453mDHOU09axyhQ+NGAbq3Wdn5ZCI/yuRjb9znF//m7k +gjSn2MYvdjUJxV0oWcRi1Rbj3g0VgJ1FO4eJE/+i9UvqmAJRmnFB49ZRrjVVIw40aVz LvmBVO6AtTbGcdFvuFKxqGpR57DA3a7/MkUg4WXNFHkdfI0tLca9WmYE4Uxq7WyGO9hW 1zHA== X-Gm-Message-State: AFqh2kqp8Uun5ZIB5HQH5c/dHkUzFE9xhOgOdpRQXdZ4b1IWxQkIf4YV pAd+y2VhyxN+dzy9910jyRn+8MKfmjSZf8SS1BuGJxz/a8zcgg== X-Google-Smtp-Source: AMrXdXs6JuoXvmea0Dzg2/rp1rVpsg0eT8JZMf/8Bg+RDnfTRZcOsS+JZvSOMBADCumZundEStnFFUIxUKAArBhQ/+4= X-Received: by 2002:a05:6402:25c4:b0:470:2821:b72c with SMTP id x4-20020a05640225c400b004702821b72cmr3849744edb.282.1672408126726; Fri, 30 Dec 2022 05:48:46 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::52b; envelope-from=damien.mattei@gmail.com; helo=mail-ed1-x52b.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:18806 Archived-At: 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" On Fri, Dec 30, 2022 at 10:36 AM Damien Mattei wrote: > hi, > how do i declare in Guile a function that in C is of this type: > int foo(int,int,char *) > the problem i have is with the char *: > (define cfunc (foreign-library-function "libguile-cfunc" "openmp" > #:return-type int #:arg-types (list int int ????))) > i do not know what to put in place of ???? > > Regards, > Damien > > note: what if const char* ? (not sure i need it) >