unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Matt Wette <matt.wette@gmail.com>
To: guile-user@gnu.org
Subject: Re: Custom foreign types
Date: Thu, 20 Jun 2024 06:17:04 -0700	[thread overview]
Message-ID: <0d127d0c-86c2-4649-a820-93cc1ca52054@gmail.com> (raw)
In-Reply-To: <be871b07-75b2-47f1-9ab1-2e7217139a65@gmail.com>



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





      reply	other threads:[~2024-06-20 13:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-17  2:13 Custom foreign types Ryan Raymond
2024-06-19 22:16 ` Maxime Devos via General Guile related discussions
2024-06-20  0:11 ` Matt Wette
2024-06-20 13:17   ` Matt Wette [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0d127d0c-86c2-4649-a820-93cc1ca52054@gmail.com \
    --to=matt.wette@gmail.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).