]> Nishi Git Mirror - serenade.git/commitdiff
idk
authornishi <nishi@0f02c867-ac3d-714e-8a88-971ba1f6efcf>
Thu, 25 Apr 2024 06:02:50 +0000 (06:02 +0000)
committernishi <nishi@0f02c867-ac3d-714e-8a88-971ba1f6efcf>
Thu, 25 Apr 2024 06:02:50 +0000 (06:02 +0000)
git-svn-id: file:///raid/svn-main/nishi-serenade/trunk@34 0f02c867-ac3d-714e-8a88-971ba1f6efcf

Serenade/ffi_binding.c

index 24933da3f77b9e8a873028957f18c27ff61af500..796275c98fcc66a4246d27b98a4cb755b0f2bb12 100644 (file)
@@ -75,8 +75,7 @@ struct sn_generic* function_caller_handler(struct sn_interpreter* sn, int args,
        struct sn_generic* gen = malloc(sizeof(struct sn_generic));
        gen->type = SN_TYPE_VOID;
        struct ffi_info* info = (struct ffi_info*)gens[0]->ptr;
-       void** fargs = malloc(sizeof(void*) * (info->argc + 1));
-       fargs[info->argc] = 0;
+       void** fargs = malloc(sizeof(void*) * (info->argc));
        if(info->argc > 0){
                int i;
                for(i = 0; i < info->argc; i++){
@@ -95,7 +94,8 @@ struct sn_generic* function_caller_handler(struct sn_interpreter* sn, int args,
                        fargs[i] = ptr;
                }
        }
-       ffi_call(&info->cif, FFI_FN(info->ptr), NULL, fargs);
+       void* result;
+       ffi_call(&info->cif, FFI_FN(info->ptr), &result, fargs);
        if(fargs != NULL) free(fargs);
        return gen;
 }