From: Catonano <catonano@gmail.com>
To: guile-user@gnu.org
Subject: type friction C <-> scheme
Date: Fri, 9 Jun 2017 22:36:45 +0200 [thread overview]
Message-ID: <CAJ98PDwUA483QdtADZqafwKOmBE992e9FjQ0yctSyOd2zxTPbg@mail.gmail.com> (raw)
Here we go again
After successfully wrapping freexl_open, I can't do the same with
freexl_get_info
One of the arguments expected by such function is "unsigned short"
When I load the namespace at the REPL I get
scheme@(guile-user)> ,m (freexl common)
While executing meta-command:
ERROR: In procedure pointer->procedure: Wrong type argument in position 3:
int
I tried with uint8, uint16 and uint32, with the same result
Here's the function I'm referring to
https://www.gaia-gis.it/gaia-sins/freexl-1.0.1-doxy-doc/html/freexl_8h.html#ad6dbe072c7a4632853d90f4509bf3aee
And here's my code (there are some instructions as comments in the code)
https://gitlab.com/humanitiesNerd/guile-freexl
And here's an excerpt
(define freexl-get-info
(let* ((ptr (freexl-func "freexl_get_info"))
(proc (pointer->procedure int ptr '(* int *)))
;;the int in the arguments list generates
;;a wrong argument type error when
;;loading the namespace at the REPL, like this
;;scheme@(guile-user)> ,m (freexl common)
;;While executing meta-command:
;;ERROR: In procedure pointer->procedure: Wrong type argument
;;in position 3: int
)
(lambda (handle-ptr what)
(let* ((outcome-ptr (bytevector->pointer (make-bytevector (sizeof
'*))))
(result (proc handle-ptr what outcome-ptr)))
(if (not (= result 0))
(throw 'get-info-error 'error-code result)
outcome-ptr)
))))
Thanks in advance
next reply other threads:[~2017-06-09 20:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-09 20:36 Catonano [this message]
2017-06-09 20:52 ` type friction C <-> scheme Mike Gran
2017-06-09 21:33 ` Catonano
2017-06-09 20:56 ` Matt Wette
2017-06-09 21:39 ` Catonano
2017-06-09 22:33 ` Matt Wette
2017-06-10 6:26 ` Catonano
2017-06-11 5:50 ` Mark H Weaver
2017-06-11 13:07 ` Matt Wette
2017-06-11 17:15 ` Catonano
2017-06-11 18:01 ` Matt Wette
2017-06-11 18:20 ` Catonano
2017-06-12 8:00 ` David Pirotte
2017-06-12 12:45 ` Matt Wette
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=CAJ98PDwUA483QdtADZqafwKOmBE992e9FjQ0yctSyOd2zxTPbg@mail.gmail.com \
--to=catonano@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).