提交 a86b5813 编写于 作者: R Rodrigo Kumpera

Merge pull request #2525 from kumpera/embedding-api

[api] Add API kill switch.
......@@ -3651,6 +3651,9 @@ AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)
#This must always be defined when building the runtime
AC_DEFINE(MONO_INSIDE_RUNTIME,1, [Disable banned functions from being used by the runtime])
mono_build_root=`pwd`
AC_SUBST(mono_build_root)
......
......@@ -1970,7 +1970,10 @@ mono_get_method_from_token (MonoImage *image, guint32 token, MonoClass *klass,
MonoMethod *
mono_get_method (MonoImage *image, guint32 token, MonoClass *klass)
{
return mono_get_method_full (image, token, klass, NULL);
MonoError error;
MonoMethod *result = mono_get_method_checked (image, token, klass, NULL, &error);
mono_error_cleanup (&error);
return result;
}
MonoMethod *
......@@ -1979,11 +1982,7 @@ mono_get_method_full (MonoImage *image, guint32 token, MonoClass *klass,
{
MonoError error;
MonoMethod *result = mono_get_method_checked (image, token, klass, context, &error);
mono_loader_assert_no_error ();
if (!mono_error_ok (&error)) {
mono_loader_set_error_from_mono_error (&error);
mono_error_cleanup (&error);
}
mono_error_cleanup (&error);
return result;
}
......@@ -2126,12 +2125,7 @@ mono_get_method_constrained (MonoImage *image, guint32 token, MonoClass *constra
{
MonoError error;
MonoMethod *result = mono_get_method_constrained_checked (image, token, constrained_class, context, cil_method, &error);
mono_loader_assert_no_error ();
if (!mono_error_ok (&error)) {
mono_loader_set_error_from_mono_error (&error);
mono_error_cleanup (&error);
}
mono_error_cleanup (&error);
return result;
}
......
......@@ -8,14 +8,14 @@ MONO_BEGIN_DECLS
typedef mono_bool (*MonoStackWalk) (MonoMethod *method, int32_t native_offset, int32_t il_offset, mono_bool managed, void* data);
MONO_API MonoMethod *
MONO_RT_EXTERNAL_ONLY MONO_API MonoMethod *
mono_get_method (MonoImage *image, uint32_t token, MonoClass *klass);
MONO_API MonoMethod *
MONO_RT_EXTERNAL_ONLY MONO_API MonoMethod *
mono_get_method_full (MonoImage *image, uint32_t token, MonoClass *klass,
MonoGenericContext *context);
MONO_API MonoMethod *
MONO_RT_EXTERNAL_ONLY MONO_API MonoMethod *
mono_get_method_constrained (MonoImage *image, uint32_t token, MonoClass *constrained_class,
MonoGenericContext *context, MonoMethod **cil_method);
......
......@@ -73,6 +73,22 @@ MONO_API void mono_free (void *);
#define MONO_CONST_RETURN const
#if defined (MONO_INSIDE_RUNTIME)
#if defined (__clang__)
#define MONO_RT_EXTERNAL_ONLY __attribute__ ((unavailable("The mono runtime must not call this function")))
#elif defined (__GNUC__)
#define MONO_RT_EXTERNAL_ONLY __attribute__ ((error("The mono runtime must not call this function")))
#else
#define MONO_RT_EXTERNAL_ONLY
#endif /* __clang__ */
#else
#define MONO_RT_EXTERNAL_ONLY
#endif /* MONO_INSIDE_RUNTIME */
MONO_END_DECLS
#endif /* __MONO_PUBLIB_H__ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册