Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/python-wasm
Path: blob/main/core/dylink/test/libc-archive/app.c
1393 views
1
#include <stdio.h>
2
#include <assert.h>
3
#include "app.h"
4
5
extern void* dlopen(const char* filename, int flags);
6
extern void* dlsym(void* handle, const char* symbol);
7
8
int main() {
9
printf("Loading hello dynamic library...\n");
10
void* handle = dlopen("./hello.so", 2);
11
printf("Got handle=%p\n", handle);
12
assert(handle != NULL);
13
FUNCTION hello = (FUNCTION)dlsym(handle, "hello");
14
assert(hello != NULL);
15
printf("Got hello=%p\n", hello);
16
printf("hello():\n\n");
17
(*hello)();
18
19
printf("\nDone\n");
20
}
21
22
23