[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Foreign Function Interface
- To: info-macl@cambridge.apple.com
- Subject: Foreign Function Interface
- From: Josh Lubell <lubell@cs.UMD.EDU>
- Date: Wed, 19 Sep 90 11:39:10 -0400
Help, Does anyone have an example of how to use the foreign function
interface for pascal. When I try to run the code below, I get the
following error. What am I doing wrong?
> Error: There is no foreign entry point named "addthree"
> While executing: FF-LOOKUP
> Type Command-/ to continue, Command-. to abort.
P.S. Also, what libraries do I need to load to use MACAPP files?
Here is the Pascal code:
UNIT Foo;
INTERFACE
FUNCTION plus_one (i: INTEGER) : INTEGER;
FUNCTION addthree (i: INTEGER; FUNCTION Lispfn(i: INTEGER): INTEGER):
INTEGER;
IMPLEMENTATION
FUNCTION plus_one;
BEGIN
plus_one := i+1;
END;
FUNCTION addthree;
BEGIN
i := i + 1;
addthree := Lispfn (i);
END;
END.
>> Here is the lisp code:
;;; -*- Mode: LISP; Base: 10; Package: CCL; Syntax: Common-Lisp; -*-
(lisp:in-package 'ccl)
(def-logical-pathname "ff;" "hd:foo:")
(def-logical-pathname "mpwlib;" "hd:systems:languages:mpw:libraries:libraries")
(require :ff)
(ff-load "ff;foo.p.o"
:ffenv-name 'test
:libraries '("mpwlib;interface.o"))
(defpascal add-one ((i :long) (:result :long))
(+ i 1))
(deffpfun (add-three "addthree") ((fixnum :long) (t :ptr)) :long)
>> Thanks for the help...
Josh Lubell