[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: guile-user Digest, Vol 216, Issue 19
From: |
Tim Meehan |
Subject: |
Re: guile-user Digest, Vol 216, Issue 19 |
Date: |
Wed, 25 Nov 2020 11:15:16 -0600 |
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 ?
>
>
>
>