12 #include "networking/server/ServerSocket.hpp"
19 explicit DLLoader(
const std::string &libraryPath)
21 std::cout <<
"Loading library: " << libraryPath <<
'\n';
22 handle = dlopen(libraryPath.c_str(), RTLD_LAZY);
24 std::cerr <<
"Cannot open library: " << dlerror() <<
'\n';
26 std::cout <<
"Library loaded\n";
39 auto *create = (create_t *)dlsym(handle, functionName.c_str());
40 const char *dlsym_error = dlerror();
42 std::cerr <<
"Cannot load symbol '" << functionName <<
"': " << dlsym_error <<
'\n';
46 std::cerr <<
"Function '" << functionName <<
"' not found in the library.\n";
49 std::cout <<
"Function '" << functionName <<
"' found in the library.\n";
50 return create(socket);
55 void *handle =
nullptr;