Skip to content

Commit 8507e60

Browse files
committed
Corrected comments
1 parent 49a6836 commit 8507e60

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

examples/c_ffi_call/value_ffi.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -700,9 +700,8 @@ static int _call_wrapper(metac_value_t * p_param_storage_val, void (*fn)(void),
700700

701701
// idea: check all params
702702
// if we see 0 va_list - call directly.
703-
// if we see 1 va_list - call special wrapper and
704-
// put va_list-internals as ... arg. Wrapper will convert .. to va_list and we can feed it to call
705-
// if we see more than 1 - we currently don't support this.
703+
// if we see 1 or more va_list - call special ffi wrapper and
704+
// put va_list-internals as ... arg. Wrapper will convert ... to va_list and we can feed it to call
706705
int metac_value_call(metac_value_t * p_param_storage_val, void (*fn)(void), metac_value_t * p_res_value) {
707706
_check_(
708707
p_param_storage_val == NULL ||

examples/c_ffi_call/value_ffi_test.c

+12-2
Original file line numberDiff line numberDiff line change
@@ -775,10 +775,21 @@ METAC_START_TEST(test_variadic_arg) {
775775
metac_tag_map_delete(p_tagmap);
776776
}END_TEST
777777

778-
// this test doesn't work on x86 linux.. though works on big-endian linux
778+
// WARNING: this test doesn't work on x86 linux.. though works on big-endian linux
779779
// getting
780780
//value_ffi_test.c:804:F:default:test_variadic_list:0: called: got test_function_with_va_list
781781
// 6c76 726d2f65 2d73762f 63617073 2f636174 2f656475, expected test_function_with_va_list 1 2 3 4 5 6
782+
// even though I'm getting debug dbg0: 1 2 3 4 5 6 before calling ffi_call
783+
// and even after. looks like I'm not clear on how to pass va_list... current implementation works
784+
// like it's a struct
785+
/*
786+
values[i] = &p_val_list_entries[va_list_number_cur].va_list_c.parameters;
787+
va_list cp;
788+
va_copy(cp, p_val_list_entries[va_list_number_cur].va_list_c.parameters);
789+
vfprintf(stderr, "dbg0: %x %x %x %x %x %x\n", cp);
790+
va_end(cp);
791+
*/
792+
// that means that we can' pass va_list as argument, because we can't use it when we call fn.
782793

783794
#if __linux__
784795
START_TEST(test_variadic_list) {
@@ -815,7 +826,6 @@ METAC_START_TEST(test_variadic_list) {
815826
free(s);
816827

817828
_CALL_PROCESS_END
818-
819829
);
820830

821831
metac_tag_map_delete(p_tagmap);

0 commit comments

Comments
 (0)