[plt-scheme] Foreign Function Interface...

From: geb a (geb_a at yahoo.com)
Date: Thu Mar 8 18:06:39 EST 2007

I have been working with the Foreign Function
Interface  to ImageMagick.  It appears that c-pointer
cannot be passed to a scheme function.  It that
correct?  Is it possible to create a c-pointer
parameter so that it may  be passed?

Am I even asking the right questions? :-)

Thanks for the help.

Sincerely,

Dan

(define (average r g b)
  (/ (+ r g b) 3))

(define (wand->number wand)
    (average
          (car  (test (MagickGetImageChannelMean wand
'RedChannel)))
          (car  (test (MagickGetImageChannelMean wand
'GreenChannel)))
          (car  (test (MagickGetImageChannelMean wand
'BlueChannel)))))

(define w (test (MagickReadImage "test.jpg")))
> w
#<cpointer:MagickWand>
>  (wand->number w)
. .
../../../../../../usr/local/plt/collects/ffi/magick.ss::16917:
MagickWand: (CoderError) Application transferred too
few scanlines `test.jpg'
> 


 
____________________________________________________________________________________
8:00? 8:25? 8:40? Find a flick in no time 
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news


Posted on the users mailing list.