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 14:48:35 +0100

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"

On Fri, Dec 30, 2022 at 10:36 AM Damien Mattei <damien.mattei@gmail.com>
wrote:

> hi,
> how do i declare in Guile a function that in C is of this type:
> int foo(int,int,char *)
> the problem i have is with the char *:
> (define cfunc (foreign-library-function "libguile-cfunc" "openmp"
> #:return-type int #:arg-types (list int int ????)))
> i do not know what to put in place of ????
>
> Regards,
> Damien
>
> note: what if const char* ? (not sure i need it)
>


reply via email to

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