31 lines
619 B
C
31 lines
619 B
C
#include <fx/reflection/function.h>
|
|
#include <fx/value.h>
|
|
#include <inttypes.h>
|
|
#include <stdio.h>
|
|
|
|
int main(int argc, const char **argv)
|
|
{
|
|
fx_value_type arg_types[] = {
|
|
FX_VALUE_TYPE_CSTR,
|
|
};
|
|
|
|
fx_function *func = fx_function_create(
|
|
"test_function",
|
|
FX_FUNCTION_F_VARARG,
|
|
(fx_function_impl)printf,
|
|
arg_types,
|
|
1,
|
|
FX_VALUE_TYPE_INT);
|
|
|
|
fx_value args[] = {
|
|
FX_VALUE_CSTR("Hello %s! You are number %lf\n"),
|
|
FX_VALUE_CSTR("Jonh"),
|
|
FX_VALUE_DOUBLE(2.5),
|
|
};
|
|
|
|
fx_value result = FX_VALUE_EMPTY;
|
|
int r = fx_function_invoke(func, args, 3, &result);
|
|
printf("%" PRIdPTR "\n", result.v_int);
|
|
return 0;
|
|
}
|