From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Matt Wette Newsgroups: gmane.lisp.guile.user Subject: Re: Custom foreign types Date: Thu, 20 Jun 2024 06:17:04 -0700 Message-ID: <0d127d0c-86c2-4649-a820-93cc1ca52054@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15037"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Thu Jun 20 15:17:49 2024 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 1sKHfg-0003gr-NT for guile-user@m.gmane-mx.org; Thu, 20 Jun 2024 15:17:48 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKHf7-0000nb-EJ; Thu, 20 Jun 2024 09:17:13 -0400 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 1sKHf5-0000me-9v for guile-user@gnu.org; Thu, 20 Jun 2024 09:17:11 -0400 Original-Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sKHf3-0000Pf-4D for guile-user@gnu.org; Thu, 20 Jun 2024 09:17:10 -0400 Original-Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-7061d37dc9bso798016b3a.2 for ; Thu, 20 Jun 2024 06:17:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718889426; x=1719494226; darn=gnu.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=/2qcU2eh4vVcLK2TsIlNJBFWvXy9Ipxuxu2BsBr2YY8=; b=Y3zYMnz+7nIDOODFXi5ddrDHeT+CFZEST0AJlO7HTEIVnl5uv499hGLYMkYKxPJCSl /arFuHBBs+rWkBp2dbq7llUOYu08x4uCrjPF34oDzmetkt9PUK1ucQtZeD8baVqcMam9 gFbV56vSbhhSCq+NSHATIt+NE1IqrKm8LBHtRzCnJiD+xg1qnnA13D6W1w2HZq+Dx/T1 G3yXgmy3SDWO8eUBfF5OcFrx5nBs2KT3peaNw2xgA+k7/uGMyNRFkau4PeXe977vQAJi k3KgwavOvTEbA6ZqV0FlE4QLG83C84nItivRhpNQnkXbRTQ0vG+yrAbXCUS4jxVhAbGZ hUuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718889426; x=1719494226; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/2qcU2eh4vVcLK2TsIlNJBFWvXy9Ipxuxu2BsBr2YY8=; b=tkxFaz5yOhYFXrPXvu7+FnAVRdIh9929vFbT5Lzti9nnIzik3tzNgKU9apx5gOnQmY XgJ1OufoTDtxQZ0tUWlOPllcyyMdrhLypQNHCrua9neGFEnRyPeIvq8GqUm1RTmOsgkx FHwNIQNp4/a1C/bl4PnoUOuv4qShSF5Eq4D5et91+HkD5jrwmsoRTcfGKXZQDIdlr74G dnFgjVwa+hXka6M71WDHFM9mxtsazeSSh85bGP9LZ4mhY1xmnTv6Y5kFFeMThRXLVU2R 0/njr+1cgrMn7Bt4Xzgexnt4lFBN7x3iIzw+5btrizILyo9qdLWHYuk9ptT2YWt7ec6R bxmA== X-Gm-Message-State: AOJu0YzgYUEpLGv8rgCjEM6ux0Obimq3abv4zRnXHb5sf0XX6G5DwvYR G60mAUwqXNCrcJv6hWyU+jb+oR+QTTtKOlp8D2UxXv97KR2LU+AU5xOycg== X-Google-Smtp-Source: AGHT+IGVtI08A/wPMtrPmzQCaYEAUdrixn7GvklJLKxJsjTvl/iRNCxN7CHvJO92MEM1njTEZ98U4g== X-Received: by 2002:a05:6a00:7c5:b0:704:3aca:7833 with SMTP id d2e1a72fcca58-70629ceb33fmr5492253b3a.31.1718889426304; Thu, 20 Jun 2024 06:17:06 -0700 (PDT) Original-Received: from [192.168.2.154] (64-52-138-37.championbroadband.com. [64.52.138.37]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-705ccb78581sm12766289b3a.179.2024.06.20.06.17.05 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 Jun 2024 06:17:05 -0700 (PDT) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=matt.wette@gmail.com; helo=mail-pf1-x432.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:19723 Archived-At: On 6/19/24 5:11 PM, Matt Wette wrote: > On 6/16/24 7:13 PM, Ryan Raymond wrote: >> Hello, all. >> I know we can create pointers to structs with make-c-struct, but I would >> like to pass structs directly as arguments to foreign functions. I >> can do >> that by using bytevector-uint-ref, and setting the size to that of the >> struct, but when it is time to specify the type in >> pointer->procedure, I am >> out of luck if the sizes don't match. >> >> Here is how I am binding Raylib using FFI currently. >> >> Is there a cleaner way to do this? >> Ryan > I should also mention the nyacc FFI Helper tool I wrote.  You give it the header file and it will generate the ffi code.   Look here: https://www.nongnu.org/nyacc/nyacc-fh-ug.html Matt