#include <dlfcn.h>
#include <stdio.h>

typedef void (*greet_t)(const char *name);

int main(void) {
    // this was `./libmain.so`
    void *lib = dlopen("./libgreet.so", RTLD_LAZY);
    if (!lib) {
        fprintf(stderr, "failed to load library\n");
        return 1;
    }
    greet_t greet = (greet_t) dlsym(lib, "greet");
    if (!lib) {
        fprintf(stderr, "could not look up symbol 'greet'\n");
        return 1;
    }
    greet("venus");
    dlclose(lib);
    return 0;
}
