Skip to content

Commit 467627f

Browse files
committed
Add mono_unity_gc_enable and mono_unity_gc_disable
1 parent 34dc12d commit 467627f

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

mono/metadata/unity-utils.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
#include <mono/metadata/tokentype.h>
3131
#include <mono/utils/mono-string.h>
3232

33+
#if HAVE_BDWGC_GC
34+
#include <external/bdwgc/include/gc.h>
35+
#endif
36+
3337
#include <glib.h>
3438

3539
#ifdef WIN32
@@ -900,6 +904,25 @@ mono_unity_get_unitytls_interface()
900904
return gUnitytlsInterface;
901905
}
902906

907+
// gc
908+
MONO_API void mono_unity_gc_enable()
909+
{
910+
#if HAVE_BDWGC_GC
911+
GC_enable();
912+
#else
913+
g_assert_not_reached ();
914+
#endif
915+
}
916+
917+
MONO_API void mono_unity_gc_disable()
918+
{
919+
#if HAVE_BDWGC_GC
920+
GC_disable();
921+
#else
922+
g_assert_not_reached ();
923+
#endif
924+
}
925+
903926
MONO_API void
904927
mono_unity_install_unitytls_interface(unitytls_interface_struct* callbacks)
905928
{

mono/metadata/unity-utils.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ typedef struct unitytls_interface_struct unitytls_interface_struct;
150150
MONO_API unitytls_interface_struct* mono_unity_get_unitytls_interface();
151151
MONO_API void mono_unity_install_unitytls_interface(unitytls_interface_struct* callbacks);
152152

153+
// gc
154+
MONO_API void mono_unity_gc_enable();
155+
MONO_API void mono_unity_gc_disable();
156+
153157
//misc
154158
MonoAssembly* mono_unity_assembly_get_mscorlib();
155159
MonoImage* mono_unity_image_get_mscorlib();

0 commit comments

Comments
 (0)