From 2301f0ceed00ea1d54658dcf647f6bba43184df8 Mon Sep 17 00:00:00 2001 From: goffioul Date: Wed, 26 Oct 2005 15:02:18 +0000 Subject: [PATCH] Do not use calling convention for dynamic call of C functions: save/restore the stack pointer manually, which work in all cases. --- src/c/arch/ffi_x86.d | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/c/arch/ffi_x86.d b/src/c/arch/ffi_x86.d index 7cafa7994..b2ab6e109 100644 --- a/src/c/arch/ffi_x86.d +++ b/src/c/arch/ffi_x86.d @@ -58,9 +58,11 @@ ecl_fficall_execute(void *f_ptr, struct ecl_fficall *fficall, enum ecl_ffi_tag r #ifdef _MSC_VER int bufsize = fficall->buffer_size; char* buf = fficall->buffer; + char* stack_p; __asm { + mov stack_p,esp sub esp,bufsize mov esi,buf mov edi,esp @@ -92,13 +94,11 @@ ecl_fficall_execute(void *f_ptr, struct ecl_fficall *fficall, enum ecl_ffi_tag r ((void (*)())f_ptr)(); } - if (fficall->cc == ECL_FFI_CC_CDECL) { #ifdef _MSC_VER - __asm add esp,bufsize + __asm mov esp,stack_p #else - sp += fficall->buffer_size; + sp += fficall->buffer_size; #endif - } } static void