The function takes a pointer to an integer, prints its value and returns the 
increment.
        void cl_inc(int *i){
            printf("changing int from %d to %d", *i, (++i));
        }


I've managed it by using this code:

        {#fun pure cl_inc
                        {alloca `CInt' peek*} 
                        -> `()'#}
        -}
and calling it this way:
        alloca $ \mem -> do poke mem 3; print_int_ptr_value mem

then its a matter of reading mem by using peak again.

Is there a better way letting {#func  do the marshalling to be able to do 
directly?
        print $ cl_inc 3
        4
Marc
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to