guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: interfacing C and guile


From: Damien Mattei
Subject: Re: interfacing C and guile
Date: Fri, 30 Dec 2022 17:52:11 +0100

yes Olivier, i already found this solution a few hours ago digging in the
Guile doc:

https://www.gnu.org/software/guile/manual/html_node/Void-Pointers-and-Byte-Access.html
thanks
Damien

On Fri, Dec 30, 2022 at 5:03 PM Olivier Dion <olivier.dion@polymtl.ca>
wrote:

> 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
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]