From: Damien Mattei <damien.mattei@gmail.com>
To: guile-user <guile-user@gnu.org>
Subject: Re: interfacing C and guile
Date: Fri, 30 Dec 2022 14:48:35 +0100 [thread overview]
Message-ID: <CADEOadfBsL9GssH_dsM1JL2T1ajJc=JgMnPbYE8nm7rd+=zLcg@mail.gmail.com> (raw)
In-Reply-To: <CADEOade8tdC9tbQh0vsjJh+pNWG9fzyjGr_b9v5-J1xcZH_fzg@mail.gmail.com>
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)
>
next prev parent reply other threads:[~2022-12-30 13:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-30 9:36 interfacing C and guile Damien Mattei
2022-12-30 13:48 ` Damien Mattei [this message]
2022-12-30 16:03 ` Olivier Dion via General Guile related discussions
2022-12-30 16:52 ` Damien Mattei
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='CADEOadfBsL9GssH_dsM1JL2T1ajJc=JgMnPbYE8nm7rd+=zLcg@mail.gmail.com' \
--to=damien.mattei@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).