Files
KirkOS/user/include/mlibc/tests/rtld/ifunc-dlopen/test.c
T
kaguya 9a9b91c940 user: implement mlibc as the libc, finally.
It's finally done..

Signed-off-by: kaguya <vpshinomiya@protonmail.com>
2026-05-02 03:31:49 -04:00

24 lines
381 B
C

#include <assert.h>
#include <dlfcn.h>
int foo(void);
#ifdef USE_HOST_LIBC
#define LIB "libnative-ifunc-test-dlopen.so"
#else
#define LIB "libifunc-test-dlopen.so"
#endif
int main(void) {
void *handle = dlopen(LIB, RTLD_NOW | RTLD_LOCAL);
assert(handle);
int (*func)() = (int (*)()) dlsym(handle, "foo");
assert(func);
int ret = func();
assert(ret == 69);
return 0;
}