aboutsummaryrefslogtreecommitdiff
path: root/include/program.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/program.h')
-rw-r--r--include/program.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/include/program.h b/include/program.h
index aa318d9..dc65cb7 100644
--- a/include/program.h
+++ b/include/program.h
@@ -38,13 +38,11 @@
#define AMAL_PROGRAM_INVALID_IMPORTS -26
#define AMAL_PROGRAM_SECTION_ERROR -27
-#define AMAL_PROGRAM_ARGS_SIZE_VARARGS -1
-
#define AMAL_PROGRAM_MAX_RETURN_VALUES 128
typedef struct {
void *func;
- int args_byte_size; /* -1 if varargs (AMAL_PROGRAM_ARGS_SIZE_VARARGS) */
+ u32 args_byte_size;
} ProgramExternFunc;
typedef struct {
@@ -81,9 +79,10 @@ void amal_program_deinit(amal_program *self);
/*
returns @AMAL_PROGRAM_EXTERN_FUNC_ALREADY_EXISTS if a function with the name @name already exists
- in the program
+ in the program.
+ If the function has a vararg parameter, then @args_byte_size should be the minimum parameters size excluding the varargs.
*/
-CHECK_RESULT int amal_program_register_extern_func(amal_program *self, BufferView name, void *func_ptr, int args_byte_size);
+CHECK_RESULT int amal_program_register_extern_func(amal_program *self, BufferView name, void *func_ptr, u32 args_byte_size);
CHECK_RESULT int amal_program_append_bytecode(amal_program *self, Bytecode *bytecode);
CHECK_RESULT int amal_program_run(amal_program *self);