#include <stdio.h>
#include <crazy_linker.h>
#include "test_util.h"
typedef bool (*FunctionPtr)();
#define LIB_NAME "libcrazy_linker_tests_libzoo.so"
int main() {
crazy_context_t* context = crazy_context_create();
crazy_library_t* library;
if (!crazy_library_open(&library, LIB_NAME, context)) {
Panic("Could not open library: %s\n", crazy_context_get_error(context));
}
FunctionPtr zoo_func;
if (!crazy_library_find_symbol(
library, "Zoo", reinterpret_cast<void**>(&zoo_func))) {
Panic("Could not find 'Zoo' in " LIB_NAME "\n");
}
bool ret = (*zoo_func)();
if (!ret)
Panic("'Zoo' function failed!");
printf("Closing " LIB_NAME "\n");
crazy_library_close(library);
crazy_context_destroy(context);
printf("OK\n");
return 0;
}