[plt-scheme] Issue with Output _cvector Types Held in Variables

From: Eli Barzilay (eli at barzilay.org)
Date: Mon Jan 26 16:49:09 EST 2009

On Jan 26, Henk Boom wrote:
> As I would expect, the ffi reports no error from the following (I'm
> just using 'printf as an example, I know it makes no sense and is
> dangerous):
> 
> #lang scheme/base
> (require scheme/foreign)
> (unsafe!)
> (define test (get-ffi-obj 'printf #f (_fun (_cvector o _int 4) -> _void)))
> (test)
> 
> If I put the cvector type in a variable, however:
> 
> #lang scheme/base
> (require scheme/foreign)
> (unsafe!)
> (define t (_cvector o _int 4))
> (define test (get-ffi-obj 'printf #f (_fun t -> _void)))
> (test)
> 
> and I get the error:
> 
> ffi:printf: expects 1 argument, given 0
> 
> If I understand the documentation properly, the above two should be
> identical, shouldn't they?

`_cvector' is a custom type, which means that it can do special things
when it's part of a `_fun' type.

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.