[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] more on types.db

From: Jörg F . Wittenberger
Subject: [Chicken-users] more on types.db
Date: 03 Oct 2011 12:38:49 +0200

In types.db there is:

(#(procedure #:clean #:enforce)
 ##sys#foreign-pointer-argument (pointer) pointer)
((pointer) #(1)))

I don't have a good guess what the second list in the declaration
"((pointer) #(1))" means.

Nevertheless, I have some code, which checks that the pointer is either
NULL or given.  Like this:

(define-foreign-variable interrupt-callback c-pointer "the_callback")
 (if interrupt-callback
(let ((cb ((foreign-lambda* scheme-object () "return(CHICKEN_gc_root_ref(the_callback));"))) (rc (((foreign-lambda* scheme-object () "return(CHICKEN_gc_root_ref(the_callback_result));"))
                 ((foreign-lambda* c-pointer () "return(&the_result);")))))
        (set! interrupt-callback #f)

Which works so far and the manual has to say on c-pointer:
=== c-pointer

An untyped operating-system pointer or a locative. The value {{#f}} is also
allowed and is passed as a {{NULL}} pointer. If uses as the type of
a return value, a {{NULL}} pointer will be returned as {{#f}}.

So I guess something has to be done about the declaration?

best regards


reply via email to

[Prev in Thread] Current Thread [Next in Thread]