Changes between Version 9 and Version 10 of BlockObjects


Ignore:
Timestamp:
Aug 13, 2011 5:51:58 AM (3 years ago)
Author:
chak
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • BlockObjects

    v9 v10  
    4343Conversely, a C block object can be used as a function in Haskell.  Given the following C prototype 
    4444{{{ 
    45 typedef void (^callback_t)(handle); 
     45typedef void (^callback_t)(int); 
    4646 
    4747callback_t  
     
    5050assume the FFI declaration 
    5151{{{ 
    52 foreign import ccall get_callback :: IO (Handle -> IO ()) 
    53   -- where 'Handle' is a new type of some C pointer type 
     52foreign import ccall get_callback :: IO (CInt -> IO ()) 
    5453}}} 
    5554We might use the imported C function as follows: 
     
    5756do 
    5857  callback <- get_callback 
    59   callback myHandle 
     58  callback 42 
    6059}}} 
    6160'''TODO:''' Is there a better example? Something from an official API?