From: Tim Meehan <btmeehan@gmail.com>
Cc: guile-user@gnu.org
Subject: Re: guile-user Digest, Vol 216, Issue 19
Date: Wed, 25 Nov 2020 11:15:16 -0600 [thread overview]
Message-ID: <CACgrOx+o63wwQeU_XTgntv-8zQ8d9p24wQmOx_vOSY4JqKVOtA@mail.gmail.com> (raw)
In-Reply-To: <c202b039985aebf83118dec4c0d5c8369f1533d4.camel@riseup.net>
Hi Adriano, I hope you mean the int pointer example and not the GTK
example. I wasn't able to get the GTK example working.
The int pointer example worked like this:
// C code, compiled with:
// gcc stuff.c -o libstuff.so -fPIC -shared
void increment_intptr(int *a) { *a += 1; }
;; Guile source
(use-modules (system foreign)
(rnrs bytevectors))
(define libstuff (dynamic-link "./libstuff.so"))
(define increment
(pointer->procedure
void
(dynamic-func "increment_intptr" libstuff)
(list '*)))
(let ([b (make-bytevector (sizeof int))])
(display b)
(newline)
(increment (bytevector->pointer b))
(display b)
(newline))
On Wed, Nov 25, 2020 at 6:17 AM Adriano Peluso <randomlooser@riseup.net>
wrote:
> Il giorno mar, 24/11/2020 alle 15.26 -0600, Tim Meehan ha scritto:
> > Matt - thanks for the help making the FFI pointers work!
>
> Would you mind publishing the working version of your code ?
>
>
>
>
prev parent reply other threads:[~2020-11-25 17:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.199.1606106579.13151.guile-user@gnu.org>
2020-11-24 21:26 ` guile-user Digest, Vol 216, Issue 19 Tim Meehan
2020-11-25 12:16 ` Adriano Peluso
2020-11-25 17:15 ` Tim Meehan [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=CACgrOx+o63wwQeU_XTgntv-8zQ8d9p24wQmOx_vOSY4JqKVOtA@mail.gmail.com \
--to=btmeehan@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).