Fix function signature in #native

This commit is contained in:
bʰedoh₂ swé 2024-06-18 16:44:41 +05:00
parent f4791c5177
commit 2edad022b6
2 changed files with 5 additions and 6 deletions

View File

@ -540,10 +540,10 @@ void execute(Stack *stack, Stack *originstack, char *modname)
if (!module)
kms(stack, "UNABLE TO OPEN DYNAMIC LIBRARY");
int (*labashka)(unsigned short (*pop)(void), void (*push)(unsigned short), size_t (*len)(void),
size_t max_size);
labashka = (int (*)(unsigned short (*pop)(void), void (*push)(unsigned short), size_t (*len)(void),
size_t max_size))dlsym(module, "labashka");
void (*labashka)(unsigned short (*pop)(void), void (*push)(unsigned short), size_t (*len)(void),
size_t max_size);
labashka = (void (*)(unsigned short (*pop)(void), void (*push)(unsigned short), size_t (*len)(void),
size_t max_size))dlsym(module, "labashka");
stack_init_callback(stack);

View File

@ -6,9 +6,8 @@
// or
// cc -shared -fPIC native_test.c -o native_test.dll
int labashka(unsigned short (*pop)(void), void (*push)(unsigned short), size_t (*len)(void), size_t max_size ) {
void labashka(unsigned short (*pop)(void), void (*push)(unsigned short), size_t (*len)(void), size_t max_size ) {
printf("At %zu, there's %d.\n", len(), pop());
push(12);
printf("Maximum size is %zu.\n", max_size);
return 0;
}