<html><head><meta http-equiv="content-type" content="text/html; charset=us-ascii"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">Hi,<div><br></div><div>I have a wrapper around a graphics library called Raylib, it has so far wrapped about 80 functions, then I added a new one and I am getting an undefined predicate error, it's the first one I've created that is 'semidet', although having experimented with the problem before this post, I don't think that's the cause, I've used SUCCESS_INDICATOR as specified, here is there predicate:</div><div><br></div><div><div><font face="Courier New">:- pred check_collision_point_circle(float::in, float::in, float::in, float::in, float::in) is semidet.</font></div></div><div><font face="Courier New"><br></font></div><div><div><font face="Courier New">:- pragma foreign_proc(</font></div><div><font face="Courier New"> "C", check_collision_point_circle(Px::in, Py::in, Cx::in, Cy::in, Radius::in),</font></div><div><font face="Courier New"> [ promise_pure, will_not_call_mercury, will_not_throw_exception</font></div><div><font face="Courier New"> , will_not_modify_trail, thread_safe, does_not_affect_liveness],</font></div><div><font face="Courier New"> "</font></div><div><font face="Courier New"> Vector2 point = { Px, Py };</font></div><div><font face="Courier New"> Vector2 center = { Cx, Cy };</font></div><div><font face="Courier New"> SUCCESS_INDICATOR = CheckCollisionPointCircle(point, center, Radius);</font></div><div><font face="Courier New"> ").</font></div></div><div><br></div><div>and here is the test code I added, the testing module concerned already correctly imports the raylib module, and has used many predicates from it without issue up until this point:</div><div><br></div><div><div><font face="Courier New">collision_detection(!S, !Player, !IO) :-</font></div><div><font face="Courier New"> ( if check_collision_point_cirle(</font></div><div><font face="Courier New"> 100.0, 100.0, 100.0, 100.0, 100.0, !IO</font></div><div><font face="Courier New"> ) then</font></div><div><font face="Courier New"> trace [io(!IO2)] (</font></div><div><font face="Courier New"> io.format("hit!\n", [], !IO2)</font></div><div><font face="Courier New"> )</font></div><div><font face="Courier New"> else</font></div><div><font face="Courier New"> trace [io(!IO2)] (</font></div><div><font face="Courier New"> io.format("miss :(\n", [], !IO2)</font></div><div><font face="Courier New"> )</font></div><div><font face="Courier New"> ), ...</font></div></div><div><br></div><div>The error I get is:</div><div><br></div><div><div><div>level_ufo.m:240: In clause for predicate `collision_detection'/6:</div><div>level_ufo.m:240: error: undefined predicate `check_collision_point_cirle'/5.</div><div>** Error making `Mercury/cs/level_ufo.c'.</div></div></div><div><br></div><div>When I examine the generated C code I can see that the function is present:</div><div><br></div><div><div><font face="Courier New">MR_bool MR_CALL</font></div><div><font face="Courier New">raylib__check_collision_point_circle_5_p_0(</font></div><div><font face="Courier New"> MR_Float Px_1,</font></div><div><font face="Courier New"> MR_Float Py_2,</font></div><div><font face="Courier New"> MR_Float Cx_3,</font></div><div><font face="Courier New"> MR_Float Cy_4,</font></div><div><font face="Courier New"> MR_Float Radius_5)</font></div><div><font face="Courier New">{</font></div><div><font face="Courier New"> {</font></div><div><font face="Courier New"> MR_bool succeeded;</font></div><div><font face="Courier New"><br></font></div><div><font face="Courier New">{</font></div><div><font face="Courier New">#define MR_PROC_LABEL raylib__check_collision_point_circle_5_p_0</font></div><div><font face="Courier New"><br></font></div><div><font face="Courier New"> MR_Float Px;</font></div><div><font face="Courier New"> MR_Float Py;</font></div><div><font face="Courier New"> MR_Float Cx;</font></div><div><font face="Courier New"> MR_Float Cy;</font></div><div><font face="Courier New"> MR_Float Radius;</font></div><div><font face="Courier New"> MR_bool SUCCESS_INDICATOR;</font></div><div><font face="Courier New"><br></font></div><div><font face="Courier New"> Px = Px_1 ;</font></div><div><font face="Courier New"> Py = Py_2 ;</font></div><div><font face="Courier New"> Cx = Cx_3 ;</font></div><div><font face="Courier New"> Cy = Cy_4 ;</font></div><div><font face="Courier New"> Radius = Radius_5 ;</font></div><div><font face="Courier New"> {</font></div><div><font face="Courier New"><br></font></div><div><font face="Courier New"> Vector2 point = { Px, Py };</font></div><div><font face="Courier New"> Vector2 center = { Cx, Cy };</font></div><div><font face="Courier New"> SUCCESS_INDICATOR = CheckCollisionPointCircle(point, center, Radius);</font></div><div><font face="Courier New"><br></font></div><div><font face="Courier New"><br></font></div><div><font face="Courier New"> ;}</font></div><div><font face="Courier New">#undef MR_PROC_LABEL</font></div><div><font face="Courier New">succeeded = SUCCESS_INDICATOR;</font></div><div><font face="Courier New">}</font></div><div><font face="Courier New"> return succeeded;</font></div><div><font face="Courier New"> }</font></div><div><font face="Courier New">}</font></div></div><div><br></div><div>So I can't really see how I have managed to get it wrong!</div><div>What did I get wrong?</div><div>Thanks,</div><div>Sean.</div><div><br></div><div><br></div></body></html>