From 627acfcc02b1bb7f4da39f15310bfcf7b3ab23ac Mon Sep 17 00:00:00 2001 From: Juan Jose Garcia Ripoll Date: Wed, 29 Jul 2009 10:42:14 +0200 Subject: [PATCH] Changed the way the callback is stored, to match the format used by callback_executor and by cmpcbk.lsp --- src/c/ffi.d | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/c/ffi.d b/src/c/ffi.d index 2391bd5c9..3e646cbbd 100644 --- a/src/c/ffi.d +++ b/src/c/ffi.d @@ -834,7 +834,7 @@ callback_executor(ffi_cif *cif, void *result, void **args, void *userdata) const cl_object frame = ecl_stack_frame_open(the_env, (cl_object)&frame_aux, 0); cl_object x; while (arg_types != Cnil) { - cl_object type = ECL_CONS_CAR(args); + cl_object type = ECL_CONS_CAR(arg_types); enum ecl_ffi_tag tag = ecl_foreign_type_code(type); x = ecl_foreign_data_ref_elt(*args, tag); ecl_stack_frame_push(frame, x); @@ -858,14 +858,15 @@ callback_executor(ffi_cif *cif, void *result, void **args, void *userdata) cl_object closure_object = ecl_make_foreign_data(@':pointer-void', sizeof(ffi_closure), closure); - cl_object data = cl_list(6, return_type, arg_types, cc_type, + cl_object data = cl_list(6, closure_object, + fun, return_type, arg_types, cc_type, ecl_make_foreign_data(@':pointer-void', sizeof(*cif), cif), ecl_make_foreign_data(@':pointer-void', (n + 1) * sizeof(ffi_type*), - types), - closure_object); - int status = ffi_prep_closure(closure, cif, callback_executor, data); + types)); + int status = ffi_prep_closure(closure, cif, callback_executor, + ECL_CONS_CDR(data)); if (status != FFI_OK) { FEerror("Unable to build callback. libffi returns ~D", 1, MAKE_FIXNUM(status));