[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: interfacing C and guile
From: |
Olivier Dion |
Subject: |
Re: interfacing C and guile |
Date: |
Fri, 30 Dec 2022 11:03:08 -0500 |
On Fri, 30 Dec 2022, Damien Mattei <damien.mattei@gmail.com> wrote:
> 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"
Try (cfunc 3 27 (string->pointer "toto")). It's available in the module
(system foreign).
--
Olivier Dion
oldiob.dev