rustdesk/main.cc
rustdesk 9ad240951e fix uni link when mac service started, by use
applicationShouldOpenUntitledFile delegate
2024-03-26 14:11:02 +08:00

28 lines
645 B
C++

#include <dlfcn.h>
#include <iostream>
int main()
{
void *handle = dlopen("../Frameworks/liblibrustdesk.dylib", RTLD_LAZY);
if (!handle)
{
std::cerr << "Cannot open library: " << dlerror() << '\n';
return 1;
}
// use dlsym to get a symbol from the library
typedef int (*some_func_t)();
some_func_t some_func = (some_func_t)dlsym(handle, "rustdesk_core_main");
const char *dlsym_error = dlerror();
if (dlsym_error)
{
std::cerr << "Cannot load symbol 'some_func': " << dlsym_error << '\n';
dlclose(handle);
return 1;
}
some_func();
dlclose(handle);
}