unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* type friction C <-> scheme
@ 2017-06-09 20:36 Catonano
  2017-06-09 20:52 ` Mike Gran
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Catonano @ 2017-06-09 20:36 UTC (permalink / raw)
  To: guile-user

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


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2017-06-12 12:45 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-09 20:36 type friction C <-> scheme Catonano
2017-06-09 20:52 ` 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

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