[m-users.] FFI C Include files not appearing
Zoltan Somogyi
zoltan.somogyi at runbox.com
Wed Jun 26 22:17:46 AEST 2019
On Tue, 25 Jun 2019 11:56:17 +0100, emacstheviking <objitsu at gmail.com> wrote:
> Can you explain why I need to pass in !IO if I am not actually going to
> modify it?
In Mercury, the I/O state represents every part of the state of the world
that is not under the control of Mercury code. In your case, the code of the
SDL library functions you are calling are modifying such state; that is
why you call them. The di,uo pair of I/O state arguments on the foreign_procs
serve to tell the Mercury compiler about this fact.
Note that these arguments *represent* the old and the new state of the world,
but do not *store* the old and new state of the world. In fact, they contain
no data whatsoever. They don't have to. The compiler can still use the data
dependencies between them to control the order in which those wrapped-up
library functions are executed, as jfondren explained.
Zoltan.
More information about the users
mailing list