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) if (!module)
kms(stack, "UNABLE TO OPEN DYNAMIC LIBRARY"); kms(stack, "UNABLE TO OPEN DYNAMIC LIBRARY");
int (*labashka)(unsigned short (*pop)(void), void (*push)(unsigned short), size_t (*len)(void), void (*labashka)(unsigned short (*pop)(void), void (*push)(unsigned short), size_t (*len)(void),
size_t max_size); size_t max_size);
labashka = (int (*)(unsigned short (*pop)(void), void (*push)(unsigned short), size_t (*len)(void), labashka = (void (*)(unsigned short (*pop)(void), void (*push)(unsigned short), size_t (*len)(void),
size_t max_size))dlsym(module, "labashka"); size_t max_size))dlsym(module, "labashka");
stack_init_callback(stack); stack_init_callback(stack);

View File

@ -6,9 +6,8 @@
// or // or
// cc -shared -fPIC native_test.c -o native_test.dll // 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()); printf("At %zu, there's %d.\n", len(), pop());
push(12); push(12);
printf("Maximum size is %zu.\n", max_size); printf("Maximum size is %zu.\n", max_size);
return 0;
} }