howto c2hs marshall in out argument by reference

19 Dec
2006
19 Dec
'06
4:31 p.m.
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
6728
Age (days ago)
6728
Last active (days ago)
0 comments
1 participants
participants (1)
-
Marc Weber