<div dir="ltr">Hi,<div>I have these two lines of code...</div><div><br></div><div><font face="courier new, monospace">:- pragma foreign_decl("C", "#include <SDL/SDL.h>").<br>:- pragma foreign_decl("C", "#include <SDL/SDL_version.h>").</font><br></div><div><br></div><div>at the top of my module in the implementation section and this code too:</div><div><font face="courier new, monospace">:- func sdl_up = int.<br>:- pragma foreign_proc("C",<br>                       sdl_up = (Result::out),<br>                       [ will_not_call_mercury<br>                       , not_thread_safe<br>                       , promise_pure<br>                       ],<br>                       "Result = SDL_Init(SDL_INIT_EVERYTHING);").</font><br><br><br><font face="courier new, monospace">:- func sdl_revision = string.<br>:- pragma foreign_proc("C",<br>                       sdl_revision = (Version::out),<br>                       [ will_not_call_mercury<br>                       , not_thread_safe<br>                       , promise_pure<br>                       ],<br>                       "Version = (MR_String*)SDL_GetRevision();").</font><br></div><div><br></div><div>The call to SDL_Init() seems to work but the compiler produces an error message saying that it cannot finf SDL_GetRevision()</div><div><br></div><div>ffi.m: In function ‘ffi__sdl_revision_0_f_0’:<br>ffi.m:37:23: warning: implicit declaration of function ‘SDL_GetRevision’; did you mean ‘SDL_GetCursor’? [-Wimplicit-function-declaration]<br>                        "Version = (MR_String*)SDL_GetRevision();").<br>                       ^~~~~~~~~~~~~~~<br>                       SDL_GetCursor<br></div><div><br></div><div>When I look at the Mercury/cs/ffi.c file i can not see any of my includes and so I wonder how it worked at alL! the command line I used was:</div><div><br></div><div>    <font face="courier new, monospace"> mmc -v -L /usr/lib/x86_64-linux-gnu/libSDL2.so -lSDL2 --make ffi<br></font></div><div><br></div><div>for a main of:</div><div><br></div><div><font face="courier new, monospace">main(!IO) :-<br>        format("WTAF? %d, %s\n",<br>               [ i(sdl_up)<br>               , s(sdl_revision)<br>               ],<br>               !IO).<br></font></div><div><br></div><div>At this early stage of my exposure to mercury(!) < 10 hours, it all feels like an uphill struggle as i can't see what I have done wrong.</div><div><br></div><div>Thanks,</div><div>Sean</div><div><br></div><div><br></div></div>