Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!cs.utexas.edu!yale!cs.yale.edu!ciancarini-paolo From: ciancarini-paolo@cs.yale.edu (paolo ciancarini) Newsgroups: comp.lang.prolog Subject: SBProlog to C parameter passing Summary: how can I invoke external routines from Prolog Keywords: Procedural Interface, C, external routines Message-ID: <25929@cs.yale.edu> Date: 29 Aug 90 14:47:03 GMT Sender: news@cs.yale.edu Organization: Yale University Computer Science Dept., New Haven, CT 06520-2158 Lines: 43 Nntp-Posting-Host: poe.systemsy.cs.yale.edu Originator: cianca@poe.CS.Yale.Edu I need help with parameter passing convention in SBProlog. The procedural interface is poorly documented, and examples provided are not useful for me. I have to implement in C a predicate send(In_Atom1, In_Atom2, InAtom3) that is always successful. I have a C file that contains a procedure send(a,b,c) char *a, *b, *c; % a,b,c: input I added a dummy envelope for my procedure (as requested by SBProlog) b_SEND() { register LONG op1,op2,op3; register LONG_PTR top; op1 = reg[1]; DEREF(op1); op2 = reg[2]; DEREF(op2); op3 = reg[3]; DEREF(op3); send(op1,op2,op3); } I follow the instructions given in the SB manual, but when I call send/3 from inside Prolog I obtain a msg #builtin 0 is not implemented and the interpreter aborts!. Moreover, it seems that my interpreter does not support the builtin '_$builtin'/1, while the manual says that it is an online predicate. What am I missing? Paolo Ciancarini