Skip to content

Commit 285a32b

Browse files
grendelloradekdoulik
authored andcommitted
Drop dependency on DylibMono when building for Xamarin.Android
Xamarin.Android no longer uses `dlopen/dlsym` to load Mono symbols on the runtime, instead it links libmonosgen-2.0 directly. In effect, the `DylibMono` class and all the associated workarounds, code etc are going away. This commit removes `DylibMono` use from `Java.Interop`
1 parent 807ed48 commit 285a32b

File tree

2 files changed

+1
-34
lines changed

2 files changed

+1
-34
lines changed

src/java-interop/java-interop-gc-bridge-mono.cc

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#include <dlfcn.h>
2828

29-
#if defined (XAMARIN_ANDROID_DYLIB_MONO)
29+
#if defined (ANDROID)
3030
using namespace xamarin::android;
3131
#endif
3232

@@ -268,13 +268,6 @@ java_interop_gc_bridge_new (JavaVM *jvm)
268268
if (jvm == NULL)
269269
return NULL;
270270

271-
#if defined (ANDROID) || defined (XAMARIN_ANDROID_DYLIB_MONO)
272-
if (!monodroid_dylib_mono_init (monodroid_get_dylib (), NULL)) {
273-
log_fatal (LOG_DEFAULT, "mono runtime initialization error: %s", dlerror ());
274-
exit (FATAL_EXIT_CANNOT_FIND_MONO);
275-
}
276-
#endif /* defined (ANDROID) || defined (XAMARIN_ANDROID_DYLIB_MONO) */
277-
278271
lookup_optional_mono_thread_functions ();
279272

280273
JavaInteropGCBridge bridge = {0};

src/java-interop/java-interop-mono.h

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,6 @@
33

44
#include "java-interop.h"
55

6-
#if defined (ANDROID) || defined (XAMARIN_ANDROID_DYLIB_MONO)
7-
8-
#include "dylib-mono.h"
9-
#include "monodroid-glue.h"
10-
11-
#define mono_class_from_mono_type (monodroid_get_dylib ()->class_from_mono_type)
12-
#define mono_class_from_name (monodroid_get_dylib ()->class_from_name)
13-
#define mono_class_get_field_from_name (monodroid_get_dylib ()->class_get_field_from_name)
14-
#define mono_class_get_name (monodroid_get_dylib ()->class_get_name)
15-
#define mono_class_get_namespace (monodroid_get_dylib ()->class_get_namespace)
16-
#define mono_class_is_subclass_of (monodroid_get_dylib ()->class_is_subclass_of)
17-
#define mono_class_vtable (monodroid_get_dylib ()->class_vtable)
18-
#define mono_domain_get (monodroid_get_dylib ()->domain_get)
19-
#define mono_field_get_value (monodroid_get_dylib ()->field_get_value)
20-
#define mono_field_set_value (monodroid_get_dylib ()->field_set_value)
21-
#define mono_field_static_set_value (monodroid_get_dylib ()->field_static_set_value)
22-
#define mono_object_get_class (monodroid_get_dylib ()->object_get_class)
23-
#define mono_thread_attach (monodroid_get_dylib ()->thread_attach)
24-
#define mono_thread_current (monodroid_get_dylib ()->thread_current)
25-
#define mono_gc_register_bridge_callbacks (monodroid_get_dylib ()->gc_register_bridge_callbacks)
26-
#define mono_gc_wait_for_bridge_processing (monodroid_get_dylib ()->gc_wait_for_bridge_processing)
27-
28-
#else /* !defined (ANDROID) && !defined (XAMARIN_ANDROID_DYLIB_MONO) */
29-
306
#undef MONO_API_EXPORT
317
#undef MONO_API_IMPORT
328
#undef MONO_API
@@ -39,8 +15,6 @@
3915
#include <mono/utils/mono-counters.h>
4016
#include <mono/utils/mono-dl-fallback.h>
4117

42-
#endif /* !defined (ANDROID) && !defined (XAMARIN_ANDROID_DYLIB_MONO) */
43-
4418
JAVA_INTEROP_BEGIN_DECLS
4519

4620
JAVA_INTEROP_END_DECLS

0 commit comments

Comments
 (0)