mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-12-12 10:19:09 +08:00
e594657f97
Signed-off-by: 21pages <pages21@163.com>
30 lines
857 B
C++
30 lines
857 B
C++
#include <dlfcn.h>
|
|
#include "my_application.h"
|
|
|
|
#define RUSTDESK_LIB_PATH "librustdesk.so"
|
|
// #define RUSTDESK_LIB_PATH "/usr/lib/rustdesk/librustdesk.so"
|
|
typedef bool (*RustDeskCoreMain)();
|
|
|
|
bool flutter_rustdesk_core_main() {
|
|
void* librustdesk = dlopen(RUSTDESK_LIB_PATH, RTLD_LAZY);
|
|
if (!librustdesk) {
|
|
fprintf(stderr,"load librustdesk.so failed\n");
|
|
return true;
|
|
}
|
|
auto core_main = (RustDeskCoreMain) dlsym(librustdesk,"rustdesk_core_main");
|
|
char* error;
|
|
if ((error = dlerror()) != nullptr) {
|
|
fprintf(stderr, "error finding rustdesk_core_main: %s", error);
|
|
return true;
|
|
}
|
|
return core_main();
|
|
}
|
|
|
|
int main(int argc, char** argv) {
|
|
if (!flutter_rustdesk_core_main()) {
|
|
return 0;
|
|
}
|
|
g_autoptr(MyApplication) app = my_application_new();
|
|
return g_application_run(G_APPLICATION(app), argc, argv);
|
|
}
|