com.lispworks.LispCalls is part of the LispWorks distribution. For Android it is part of the
7-0-0-0/etc/lispworks.jar file. See the Android interface for details. On other platforms it is defined in the JAR file
lispcalls.jar which is part of the LispWorks distribution in the
etc directory, that is
(lispworks-file "etc/lispcalls.jar"). This JAR file needs to be on the classpath (for example by the keyword argument
:java-class-path to init-java-interface).
The name argument is a string specifying a Lisp symbol. The name is parsed by a simple parser as described for com.lispworks.LispCalls.checkLispSymbol (with fboundp =
If the symbol is found, it is applied to the arguments args. For each argument, if it is a primitive type or of a class corresponding to a primitive type or a string, it is converted to the corresponding Lisp value. Otherwise it is passed as a jobject. See Types and conversion between Lisp and Java. The result of the call is converted to the return type of the method and returned from the method. The conversion of the result type allows any float to be returned as a double, but does not coerce between integers and floats. For the
Object return value, the result must be either a Java object (jobject or an instance of standard-java-object), or a Lisp object that can be converted to a Java object. See Types and conversion between Lisp and Java.
The Lisp function is an ordinary Lisp function, but it needs to return the right value. Unless the call is using the
Void callers (com.lispworks.LispCalls.callVoidA or com.lispworks.LispCalls.callVoidV), returning the wrong value will call the java-to-lisp-debugger-hook (see init-java-interface) with an appropriate condition, and then return zero of the correct type (that is 0, 0d0 or Java
null) from the call.
The call to the Lisp function is wrapped such that trying to throw out of it does not actually finish the throw, and instead returns zero of the correct type from the call. It is also wrapped by a debugger hook, which is invoked if the code tries to enter the debugger (normally as a result of an unhandled error, but could be any call to
cl:invoke-debugger). The hook calls the java-to-lisp-debugger-hook (see init-java-interface) with the condition, and then calls
cl:abort. If there is no
cl:abort restart inside the Lisp function that catches this abort, this causes returning a zero of the correct type.
An important issue to remember is that when delivering with shaking, LispWorks eliminates symbols for which there is no reference. If the only call to a Lisp symbol
foo is from Java, LispWorks will not see the reference and it will eliminate
foo. To guard against this, you can either pass
foo in a list to the deliver keyword
:keep-symbols, or more conveniently, use the function
hcl:deliver-keep-symbols (see the
LispWorks Delivery User Guide
), for example:
name specifies a symbol which is the name of a proxy definition, defined in Lisp by either define-lisp-proxy or setup-lisp-proxy. The name is parsed by a simple parser as described for com.lispworks.LispCalls.checkLispSymbol (with fboundp =
Once it found the symbol, it makes a proxy the same way that calling make-lisp-proxy with name would, and returns it. The result is an
Object that implements all the interfaces that are defined in the proxy definition, and when the methods of these interfaces are called on the object it calls into Lisp. See define-lisp-proxy for details.
createLispProxy is successful it returns the proxy object. If there is any problem, this will cause a call to
cl:error. If the
cl:error call is not handled, the java-to-lisp-debugger-hook (see init-java-interface) is called with the condition, and then
null is returned from
createLispProxy. If the error is handled and tries to throw out of the context of the Lisp side of
createLispProxy, the throw is blocked and
true, check whether the symbol is fbound.
LispWorks User Guide and Reference Manual - 13 Feb 2015