| 
									
										
										
										
											2022-05-30 15:33:30 +08:00
										 |  |  | #include <dlfcn.h>
 | 
					
						
							| 
									
										
										
										
											2022-05-23 16:25:55 +08:00
										 |  |  | #include "my_application.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-08 12:20:33 +08:00
										 |  |  | #define RUSTDESK_LIB_PATH "librustdesk.so"
 | 
					
						
							| 
									
										
										
										
											2022-08-24 17:10:34 -07:00
										 |  |  | // #define RUSTDESK_LIB_PATH "/usr/lib/rustdesk/librustdesk.so"
 | 
					
						
							| 
									
										
										
										
											2022-05-30 15:33:30 +08:00
										 |  |  | 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(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-23 16:25:55 +08:00
										 |  |  | int main(int argc, char** argv) { | 
					
						
							| 
									
										
										
										
											2022-05-30 15:33:30 +08:00
										 |  |  |   if (!flutter_rustdesk_core_main()) { | 
					
						
							|  |  |  |       return 0; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2022-05-23 16:25:55 +08:00
										 |  |  |   g_autoptr(MyApplication) app = my_application_new(); | 
					
						
							|  |  |  |   return g_application_run(G_APPLICATION(app), argc, argv); | 
					
						
							|  |  |  | } |