15 lines
411 B
C
15 lines
411 B
C
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
|
|
// Build with
|
|
// cc -shared -fPIC native_test.c -o native_test.so
|
|
// 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 ) {
|
|
printf("At %zu, there's %d.\n", len(), pop());
|
|
push(12);
|
|
printf("Maximum size is %zu.\n", max_size);
|
|
return 0;
|
|
}
|