Skip to content

Commit

Permalink
[monodroid] Add java-interop sources to build (dotnet#1675)
Browse files Browse the repository at this point in the history
Context: https://github.com/xamarin/xamarin-android/projects/1

Bumps to Java.Interop/master/5c35bcb0

Begin merging the `Java.Interop/src/java-interop` library code into
`src/monodroid` so that we can eventually unify the GC Bridge logic
between the two repos.

Add `MonoThread` and `mono_thread_current()` to `dylib-mono.h`.

Fixed `monodroid_mono_class_get_field_from_name_fptr()` signature,
where we were missing `const` for 2nd argument.

Used relevant types in the
`monodroid_mono_class_from_mono_type_fptr()` signature.
  • Loading branch information
radekdoulik authored and jonpryor committed May 17, 2018
1 parent 1a45e1e commit 88ef36b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion external/Java.Interop
1 change: 1 addition & 0 deletions src/monodroid/jni/dylib-mono.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ int monodroid_dylib_mono_init (struct DylibMono *mono_imports, const char *libmo
LOAD_SYMBOL(mono_string_new)
LOAD_SYMBOL(mono_thread_attach)
LOAD_SYMBOL(mono_thread_create)
LOAD_SYMBOL(mono_thread_current)
LOAD_SYMBOL(mono_use_llvm)


Expand Down
7 changes: 5 additions & 2 deletions src/monodroid/jni/dylib-mono.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ typedef void MonoObject;
typedef void MonoProfiler;
typedef void MonoProperty;
typedef void MonoString;
typedef void MonoThread;
typedef void MonoType;
typedef void (*MonoDomainFunc) (MonoDomain *domain, void* user_data);

Expand Down Expand Up @@ -190,12 +191,12 @@ typedef void* (*monodroid_mono_assembly_name_new_fptr) (const char *na
typedef void (*monodroid_mono_assembly_name_free_fptr) (MonoAssemblyName *aname);
typedef void* (*monodroid_mono_assembly_open_full_fptr) (const char *filename, MonoImageOpenStatus *status, mono_bool refonly);
typedef char* (*monodroid_mono_check_corlib_version_fptr) ();
typedef void* (*monodroid_mono_class_from_mono_type_fptr) (void *arg0);
typedef MonoClass* (*monodroid_mono_class_from_mono_type_fptr) (MonoType *arg0);
typedef void* (*monodroid_mono_class_from_name_fptr) (MonoImage *image, const char *name_space, const char *name);
typedef char* (*monodroid_mono_class_get_name_fptr) (MonoClass *arg0);
typedef char* (*monodroid_mono_class_get_namespace_fptr) (MonoClass *arg0);
typedef mono_bool (*monodroid_mono_class_is_subclass_of_fptr) (MonoClass *klass, MonoClass *klassc, mono_bool use_interfaces);
typedef void* (*monodroid_mono_class_get_field_from_name_fptr) (MonoClass *arg0, char *arg1);
typedef void* (*monodroid_mono_class_get_field_from_name_fptr) (MonoClass *arg0, const char *arg1);
typedef MonoClassField* (*monodroid_mono_class_get_fields_fptr) (MonoClass *arg0, void **arg1);
typedef void* (*monodroid_mono_class_get_method_from_name_fptr) (MonoClass *arg0, char *arg1, int arg2);
typedef MonoProperty* (*monodroid_mono_class_get_property_from_name_fptr) (MonoClass *klass, const char *name);
Expand Down Expand Up @@ -249,6 +250,7 @@ typedef void (*monodroid_mono_set_signal_chaining_fptr)(mono_bool cha
typedef MonoString* (*monodroid_mono_string_new_fptr)(MonoDomain *domain, const char *text);
typedef void* (*monodroid_mono_thread_attach_fptr) (MonoDomain *domain);
typedef void (*monodroid_mono_thread_create_fptr) (MonoDomain *domain, void* func, void* arg);
typedef MonoThread* (*monodroid_mono_thread_current_fptr) (void);
typedef void (*monodroid_mono_gc_disable_fptr) (void);
typedef void* (*monodroid_mono_install_assembly_refonly_preload_hook_fptr) (MonoAssemblyPreLoadFunc func, void *user_data);
typedef int (*monodroid_mono_runtime_set_main_args_fptr) (int argc, char* argv[]);
Expand Down Expand Up @@ -339,6 +341,7 @@ struct DylibMono {
monodroid_mono_property_set_value_fptr mono_property_set_value;
monodroid_mono_class_get_property_from_name_fptr mono_class_get_property_from_name;
monodroid_mono_domain_from_appdomain_fptr mono_domain_from_appdomain;
monodroid_mono_thread_current_fptr mono_thread_current;
};

MONO_API struct DylibMono* monodroid_dylib_mono_new (const char *libmono_path);
Expand Down
2 changes: 1 addition & 1 deletion src/monodroid/monodroid.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<_DebugCFlags>-ggdb3 -O0 -fno-omit-frame-pointer</_DebugCFlags>
<_ReleaseCFlags>-g -O2</_ReleaseCFlags>
<_CommonCFlags>-Ijni -Ijni/zip "-I$(MonoSourceFullPath)\mono\eglib" -std=c99 -DSGEN_BRIDGE_VERSION=$(MonoSgenBridgeVersion) -D_REENTRANT -DHAVE_CONFIG_H -DMONO_DLL_EXPORT -DJI_DLL_EXPORT -fno-strict-aliasing -ffunction-sections -fvisibility=hidden -Wformat -Werror=format-security</_CommonCFlags>
<_CommonCFlags>-Ijni -Ijni/zip "-I$(MonoSourceFullPath)\mono\eglib" -std=c99 -DSGEN_BRIDGE_VERSION=$(MonoSgenBridgeVersion) -D_REENTRANT -DHAVE_CONFIG_H -DMONO_DLL_EXPORT -DJI_DLL_EXPORT -DDYLIB_MONO -fno-strict-aliasing -ffunction-sections -fvisibility=hidden -Wformat -Werror=format-security</_CommonCFlags>
<_HostUnixCFlags>$(_CommonCFlags) -Wa,--noexecstack</_HostUnixCFlags>
<_HostUnixLdFlags>-Wall -lstdc++ -lz -shared -fpic</_HostUnixLdFlags>
<_HostCommonWinCFlags>$(_CommonCFlags) -DWINDOWS -DNTDDI_VERSION=NTDDI_VISTA -D_WIN32_WINNT=_WIN32_WINNT_VISTA -fomit-frame-pointer</_HostCommonWinCFlags>
Expand Down
3 changes: 3 additions & 0 deletions src/monodroid/monodroid.targets
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
<_CFile Include="jni\util.c" />
<_CFile Include="jni\zip\ioapi.c" />
<_CFile Include="jni\zip\unzip.c" />
<_CFile Include="$(JavaInteropSourceDirectory)\src\java-interop\java-interop.c" />
<_CFile Include="$(JavaInteropSourceDirectory)\src\java-interop\java-interop-mono.c" />
<_CFile Include="$(JavaInteropSourceDirectory)\src\java-interop\java-interop-gc-bridge-mono.c" />
</ItemGroup>
<!-- These are referenced in %(_HostRuntime.ExtraSource) -->
<ItemGroup>
Expand Down

0 comments on commit 88ef36b

Please sign in to comment.