Quoth =?ISO-8859-1?Q?Yves_Par=E8s?= <yves.pa...@gmail.com>, > You mean I have to use a type like StablePtr (IORef Stuff)? > Because there I can only "peek" (deRefStablePtr) the pointer, not "poke" it. > > I take it I should return to C a StablePtr to the new value if I don't want > to use IORefs...
Yes ... > Or else I have to use regular Ptrs with Foreign.Marshall.Alloc.malloc yes! Both of these are good ways, to do different things. In your initial message, you asked about a foreign function modifying a value in storage accessible from Haskell - that's regular Ptr. Either way, read or write, communication with the foreign layer is through Ptr, not StablePtr. StablePtr is for Haskell expressions, which would be totally inscrutable to the foreign function anyway, and which naturally do not expect to be modified, so yes, a new value shall be attached to a new StablePtr. Donn _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe