[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: type friction C <-> scheme
From: |
Matt Wette |
Subject: |
Re: type friction C <-> scheme |
Date: |
Fri, 9 Jun 2017 13:56:53 -0700 |
> On Jun 9, 2017, at 1:36 PM, Catonano <address@hidden> wrote:
>
> 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
I think your outcome-ptr should be (bytevector->pointer (make-bytevector
(sizeof unsigned-int)))
- type friction C <-> scheme, Catonano, 2017/06/09
- Re: type friction C <-> scheme, Mike Gran, 2017/06/09
- Re: type friction C <-> scheme,
Matt Wette <=
- Re: type friction C <-> scheme, Catonano, 2017/06/09
- Re: type friction C <-> scheme, Matt Wette, 2017/06/09
- Re: type friction C <-> scheme, Catonano, 2017/06/10
- Re: type friction C <-> scheme, Mark H Weaver, 2017/06/11
- Re: type friction C <-> scheme, Matt Wette, 2017/06/11
- Re: type friction C <-> scheme, Catonano, 2017/06/11
Re: type friction C <-> scheme, Matt Wette, 2017/06/11