From: nishi Date: Thu, 25 Apr 2024 06:02:50 +0000 (+0000) Subject: idk X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=7ca9ef89b05736194acec7033ed5cf2e05737d3c;p=serenade.git idk git-svn-id: file:///raid/svn-main/nishi-serenade/trunk@34 0f02c867-ac3d-714e-8a88-971ba1f6efcf --- diff --git a/Serenade/ffi_binding.c b/Serenade/ffi_binding.c index 24933da..796275c 100644 --- a/Serenade/ffi_binding.c +++ b/Serenade/ffi_binding.c @@ -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; }