Closed YellowOnion closed 5 years ago
Maybe
alloca $ \x -> [C.exp| *$(int *x) = 3] >> peek x
?
What @facundominguez said -- the anti-quotation brings into scope a variable of type int *
, and then you need to modify its value as usual. The *
inside the anti quotation is just indicating the type, it doesn't dereference the value itself.
I'm trying to use alloca to capture some values. ` alloca $ \x -> [C.exp| $(int *x) = 3]
peeking x causes a me to get junk data and not 3.