diff --git a/examples/c_ffi_call/value_ffi.c b/examples/c_ffi_call/value_ffi.c index 1adce0b..26236ab 100644 --- a/examples/c_ffi_call/value_ffi.c +++ b/examples/c_ffi_call/value_ffi.c @@ -700,9 +700,8 @@ static int _call_wrapper(metac_value_t * p_param_storage_val, void (*fn)(void), // idea: check all params // if we see 0 va_list - call directly. -// if we see 1 va_list - call special wrapper and -// put va_list-internals as ... arg. Wrapper will convert .. to va_list and we can feed it to call -// if we see more than 1 - we currently don't support this. +// if we see 1 or more va_list - call special ffi wrapper and +// put va_list-internals as ... arg. Wrapper will convert ... to va_list and we can feed it to call int metac_value_call(metac_value_t * p_param_storage_val, void (*fn)(void), metac_value_t * p_res_value) { _check_( p_param_storage_val == NULL || diff --git a/examples/c_ffi_call/value_ffi_test.c b/examples/c_ffi_call/value_ffi_test.c index 3fc4e2a..3c0af64 100644 --- a/examples/c_ffi_call/value_ffi_test.c +++ b/examples/c_ffi_call/value_ffi_test.c @@ -775,10 +775,21 @@ METAC_START_TEST(test_variadic_arg) { metac_tag_map_delete(p_tagmap); }END_TEST -// this test doesn't work on x86 linux.. though works on big-endian linux +// WARNING: this test doesn't work on x86 linux.. though works on big-endian linux // getting //value_ffi_test.c:804:F:default:test_variadic_list:0: called: got test_function_with_va_list // 6c76 726d2f65 2d73762f 63617073 2f636174 2f656475, expected test_function_with_va_list 1 2 3 4 5 6 +// even though I'm getting debug dbg0: 1 2 3 4 5 6 before calling ffi_call +// and even after. looks like I'm not clear on how to pass va_list... current implementation works +// like it's a struct +/* + values[i] = &p_val_list_entries[va_list_number_cur].va_list_c.parameters; + va_list cp; + va_copy(cp, p_val_list_entries[va_list_number_cur].va_list_c.parameters); + vfprintf(stderr, "dbg0: %x %x %x %x %x %x\n", cp); + va_end(cp); +*/ +// that means that we can' pass va_list as argument, because we can't use it when we call fn. #if __linux__ START_TEST(test_variadic_list) { @@ -815,7 +826,6 @@ METAC_START_TEST(test_variadic_list) { free(s); _CALL_PROCESS_END - ); metac_tag_map_delete(p_tagmap);