fix: macos, load multi dylib instances (#8731)
Multiple dylib instances will cause some global instances to be invalid. eg. lazy_static objects in rust side, will be created more than once. Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
		
							parent
							
								
									a4565bf0da
								
							
						
					
					
						commit
						901505e8be
					
				| @ -117,9 +117,13 @@ class PlatformFFI { | ||||
|             ? DynamicLibrary.open('librustdesk.so') | ||||
|             : isWindows | ||||
|                 ? DynamicLibrary.open('librustdesk.dll') | ||||
|                 : isMacOS | ||||
|                     ? DynamicLibrary.open("liblibrustdesk.dylib") | ||||
|                     : DynamicLibrary.process(); | ||||
|                 : | ||||
|                 // Use executable itself as the dynamic library for MacOS. | ||||
|                 // Multiple dylib instances will cause some global instances to be invalid. | ||||
|                 // eg. `lazy_static` objects in rust side, will be created more than once, which is not expected. | ||||
|                 // | ||||
|                 // isMacOS? DynamicLibrary.open("liblibrustdesk.dylib") : | ||||
|                 DynamicLibrary.process(); | ||||
|     debugPrint('initializing FFI $_appType'); | ||||
|     try { | ||||
|       _session_get_rgba = dylib.lookupFunction<F3Dart, F3>("session_get_rgba"); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user