summaryrefslogtreecommitdiff
path: root/Lisp
diff options
context:
space:
mode:
Diffstat (limited to 'Lisp')
-rw-r--r--Lisp/libobjcl.lisp2
-rw-r--r--Lisp/method-invocation.lisp10
2 files changed, 7 insertions, 5 deletions
diff --git a/Lisp/libobjcl.lisp b/Lisp/libobjcl.lisp
index d1efe53..6cb9759 100644
--- a/Lisp/libobjcl.lisp
+++ b/Lisp/libobjcl.lisp
@@ -33,8 +33,6 @@
&rest)
(defcfun ("objcl_invoke_with_types" %objcl-invoke-with-types) :pointer
- (receiver (:pointer :void))
- (method_selector (:pointer :void))
(argc :int)
(return_typespec (:pointer :char))
(arg_typespecs (:pointer (:pointer :char)))
diff --git a/Lisp/method-invocation.lisp b/Lisp/method-invocation.lisp
index 43a3365..c44fb04 100644
--- a/Lisp/method-invocation.lisp
+++ b/Lisp/method-invocation.lisp
@@ -189,11 +189,15 @@ Returns: *result* --- the return value of the method invocation.
(type-name->type-id return-type)))
(selector (selector method-name)))
(cffi:with-foreign-objects ((arg-types '(:pointer :char) (length args))
- (objc-args '(:pointer :void) (length args))
+ (objc-args '(:pointer :void) (+ (length args) 2))
(return-value-cell return-c-type))
(flet ((ad-hoc-arglist->objc-arglist! (args)
+ (setf (cffi:mem-aref objc-args '(:pointer :void) 0)
+ (pointer-to receiver)
+ (cffi:mem-aref objc-args '(:pointer :void) 1)
+ (pointer-to selector))
(loop for arg in args
- for i from 0
+ for i from 2
do (let* ((type-name (lisp-value->type-name arg))
#+(or)
(cffi-type (type-name->lisp-type type-name)))
@@ -220,7 +224,7 @@ Returns: *result* --- the return value of the method invocation.
(dealloc-ad-hoc-objc-arglist ()
(dotimes (i (length args))
(cffi:foreign-free
- (cffi:mem-aref objc-args '(:pointer :void) i))
+ (cffi:mem-aref objc-args '(:pointer :void) (+ i 2)))
(cffi:foreign-string-free
(cffi:mem-aref arg-types '(:pointer :char) i)))))
(ad-hoc-arglist->objc-arglist! args)