Skip to content

Commit

Permalink
structs work ok
Browse files Browse the repository at this point in the history
  • Loading branch information
aodinokov committed Sep 18, 2024
1 parent 8fd1522 commit e2a1f2d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 11 additions & 3 deletions examples/c_print_args_alt/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,16 @@ enum x {
xTwo = 2,
xMinusOne = -1,
};
int test_function4_with_enum_args(enum x arg0, enum x arg1, enum x arg2, list_t x) {
int test_function4_with_enum_args(enum x arg0, enum x arg1, enum x arg2) {
return 0;
}
METAC_GSYM_LINK(test_function4_with_enum_args);

int test_function4_with_struct_args(list_t x) {
return 0;
}
METAC_GSYM_LINK(test_function4_with_struct_args);

metac_tag_map_t * p_tagmap = NULL;
METAC_TAG_MAP_NEW(va_args_tag_map, NULL, {.mask =
METAC_TAG_MAP_ENTRY_CATEGORY_MASK(METAC_TEC_variable) |
Expand Down Expand Up @@ -76,8 +81,11 @@ int main() {

printf("fn returned: %i\n", METAC_WRAP_FN_RES(p_tagmap, my_printf, "%d %d\n", 10, 22));

printf("fn returned: %i\n", METAC_WRAP_FN_RES(p_tagmap, test_function4_with_enum_args, xOne, xTwo, xMinusOne, *p_list));
printf("fn returned: %i\n", METAC_WRAP_FN_RES(p_tagmap, test_function4_with_enum_args, 1, 2, -1, *p_list));
printf("fn returned: %i\n", METAC_WRAP_FN_RES(p_tagmap, test_function4_with_enum_args, xOne, xTwo, xMinusOne));
printf("fn returned: %i\n", METAC_WRAP_FN_RES(p_tagmap, test_function4_with_enum_args, 1, 2, -1));

printf("fn returned: %i\n", METAC_WRAP_FN_RES(p_tagmap, test_function4_with_struct_args, *p_list));


metac_tag_map_delete(p_tagmap);
return 0;
Expand Down
2 changes: 2 additions & 0 deletions examples/c_print_args_alt/print_args.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ static int _process_unspecified_params(
} else { \
memcpy(metac_value_addr(p_param_value), &_x_val, param_entry_byte_size); \
} \
} else if (metac_entry_has_members(p_param_type_entry) != 0) { \
memcpy(metac_value_addr(p_param_value), &_x_val, param_entry_byte_size); \
} else { \
/* not supported */ \
failure = 3; \
Expand Down

0 comments on commit e2a1f2d

Please sign in to comment.