<div dir="ltr">Getting to grips with the FFI and starting to create/port my GNU Prolog SDL2 wrapper from long ago. The "extras/graphics" folder is amazing amount of work but I liked SDL so I figured if I ever complete it to standard then it might complete the set!<br><br>I can't figure out why I can't use "uint32" in the predicate declaration, currently I use int but cast the value:<br><br><font face="courier new, monospace">:- pred sdl_delay(int::in, io::di, io::uo) is det.<br>:- pragma foreign_proc("C",<br>  sdl_delay(MSecs::in, _IO0::di, _IO::uo),<br>  [promise_pure,will_not_call_mercury,does_not_affect_liveness],<br>"<br>SDL_Delay((Uint32)MSecs);<br>").<br></font><br>What I *want* to do is this:<br><br><font face="courier new, monospace">:- pred sdl_delay(uint32::in, io::di, io::uo) is det.<br>:- pragma foreign_proc("C",<br>  sdl_delay(MSecs::in, _IO0::di, _IO::uo),<br>  [promise_pure,will_not_call_mercury,does_not_affect_liveness],<br>"<br>SDL_Delay(MSecs);<br>").<br></font><br>But when I do thois the compiler is angry with me:   :(<br><br>sdl2.m:067: In clause for predicate `main'/2:<br>sdl2.m:067:   in argument 1 of call to predicate `sdl2.sdl_delay'/3:<br>sdl2.m:067:   type error: argument has type `int',<br>sdl2.m:067:   expected type was `uint32'.<br>sdl2.m:067:   The partial type assignment was:<br>sdl2.m:067:     IsUp_4: bool.bool<br>sdl2.m:067:     V_5: string<br>sdl2.m:067:     STATE_VARIABLE_IO_0_7: io.state<br>sdl2.m:067:     STATE_VARIABLE_IO_8: io.state<br>sdl2.m:067:     V_9: string<br>sdl2.m:067:     V_10: list.list(string.poly_type)<br>sdl2.m:067:     STATE_VARIABLE_IO_11_11: io.state<br>sdl2.m:067:     STATE_VARIABLE_IO_12_12: io.state<br>sdl2.m:067:     STATE_VARIABLE_IO_19_19: io.state<br>sdl2.m:067:     V_20: string<br><br>i can see it's a type error but I thought that uint32 was a built in mercury type that would translate into the C code without issue.  ?!?!<br><br>Sean.<br></div>