From: Matt Wette <matt.wette@gmail.com>
To: Catonano <catonano@gmail.com>
Cc: guile-user@gnu.org
Subject: Re: #define SOMETHING some_value
Date: Sat, 10 Jun 2017 08:55:38 -0700 [thread overview]
Message-ID: <BC023AF1-5BF3-4432-A8D0-DCADF2F0503E@gmail.com> (raw)
In-Reply-To: <CAJ98PDxa0zZtzbmuaBJHRiaQKxMkpLBHTkrDnsUppuS4kxzSKg@mail.gmail.com>
> On Jun 10, 2017, at 1:31 AM, Catonano <catonano@gmail.com> wrote:
>
> The Freexl documentation states that I should call freexl_get_info like this
>
> freexl_get_info(&handler, FREEXL_BIFF_SHEET_COUNT, &outcome);
>
> Now, FREEXL_BIFF_SHEET_COUNT is defined in the header file like this
>
> /** Information query for BIFF sheet count */
> #define FREEXL_BIFF_SHEET_COUNT 32010
>
> But at the REPL, when I call my procedure like this
>
> scheme@(freexl common)> (freexl-open "resources/Lavoro_P.xls")
> $1 = #<pointer 0x1227f50>
> scheme@(freexl common)> (freexl-get-info $1 32010)
>
> I get
>
> ERROR: Throw to key `get-info-error' with args `(error-code -3)'.
>
> That is, an exception is being raised, as you can see in this excerpt of my
> code
>
> (define freexl-get-info
> (let* ((ptr (freexl-func "freexl_get_info"))
> (proc (pointer->procedure int ptr (list '* unsigned-int '*))))
> (lambda (handle-ptr what)
> (let* ((outcome-ptr (bytevector->pointer (make-bytevector (sizeof
> unsigned-int))))
> (result (proc handle-ptr what outcome-ptr)))
> (if (not (= result 0))
> (throw 'get-info-error 'error-code result) <-- THIS IS THE
> EXCEPTION BEING RAISED
> outcome-ptr)
> ))))
>
> How do I deal with these #define'd things ?
>
> I tried with both unsigned-int and uint16
>
> Thanks in advance
Yea. I may have steered you wrong before. (I didn’t look back.) The argument signature might need to be (list ‘* unsigned-short ‘*) rather than your current one with unsigned-int.
next prev parent reply other threads:[~2017-06-10 15:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-10 8:31 #define SOMETHING some_value Catonano
2017-06-10 9:51 ` Amirouche Boubekki
2017-06-11 19:42 ` Mark H Weaver
2017-06-11 20:07 ` Matt Wette
2017-06-15 19:21 ` Matt Wette
2017-06-16 16:37 ` Catonano
2017-06-10 15:55 ` Matt Wette [this message]
2017-06-11 17:08 ` Catonano
2017-06-11 20:06 ` Mark H Weaver
2017-06-11 20:32 ` Catonano
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=BC023AF1-5BF3-4432-A8D0-DCADF2F0503E@gmail.com \
--to=matt.wette@gmail.com \
--cc=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).