Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[java-interop] Selectively keep DylibMono for Xamarin.Android #473

Merged
merged 1 commit into from
Aug 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/java-interop/java-interop-gc-bridge-mono.cc
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,13 @@ java_interop_gc_bridge_new (JavaVM *jvm)
if (jvm == NULL)
return NULL;

#if defined (XAMARIN_ANDROID_DYLIB_MONO)
if (!monodroid_dylib_mono_init (monodroid_get_dylib (), NULL)) {
log_fatal (LOG_DEFAULT, "mono runtime initialization error: %s", dlerror ());
exit (FATAL_EXIT_CANNOT_FIND_MONO);
}
#endif /* defined (XAMARIN_ANDROID_DYLIB_MONO) */

lookup_optional_mono_thread_functions ();

JavaInteropGCBridge bridge = {0};
Expand Down
26 changes: 26 additions & 0 deletions src/java-interop/java-interop-mono.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,30 @@

#include "java-interop.h"

#if defined (XAMARIN_ANDROID_DYLIB_MONO)

#include "dylib-mono.h"
#include "monodroid-glue.h"

#define mono_class_from_mono_type (monodroid_get_dylib ()->class_from_mono_type)
#define mono_class_from_name (monodroid_get_dylib ()->class_from_name)
#define mono_class_get_field_from_name (monodroid_get_dylib ()->class_get_field_from_name)
#define mono_class_get_name (monodroid_get_dylib ()->class_get_name)
#define mono_class_get_namespace (monodroid_get_dylib ()->class_get_namespace)
#define mono_class_is_subclass_of (monodroid_get_dylib ()->class_is_subclass_of)
#define mono_class_vtable (monodroid_get_dylib ()->class_vtable)
#define mono_domain_get (monodroid_get_dylib ()->domain_get)
#define mono_field_get_value (monodroid_get_dylib ()->field_get_value)
#define mono_field_set_value (monodroid_get_dylib ()->field_set_value)
#define mono_field_static_set_value (monodroid_get_dylib ()->field_static_set_value)
#define mono_object_get_class (monodroid_get_dylib ()->object_get_class)
#define mono_thread_attach (monodroid_get_dylib ()->thread_attach)
#define mono_thread_current (monodroid_get_dylib ()->thread_current)
#define mono_gc_register_bridge_callbacks (monodroid_get_dylib ()->gc_register_bridge_callbacks)
#define mono_gc_wait_for_bridge_processing (monodroid_get_dylib ()->gc_wait_for_bridge_processing)

#else /* !defined (XAMARIN_ANDROID_DYLIB_MONO) */

#undef MONO_API_EXPORT
#undef MONO_API_IMPORT
#undef MONO_API
Expand All @@ -15,6 +39,8 @@
#include <mono/utils/mono-counters.h>
#include <mono/utils/mono-dl-fallback.h>

#endif /* !defined (XAMARIN_ANDROID_DYLIB_MONO) */

JAVA_INTEROP_BEGIN_DECLS

JAVA_INTEROP_END_DECLS
Expand Down