Completely replace mono_error_ok with is_ok and make first external_only. (#16217)
[mono-project.git] / mono / metadata / icall-internals.h
blob16d01a097ce9ad2cc59408e448683a1bea9b2f5f
1 /**
2 * \file
3 * Copyright 2016 Microsoft
4 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
5 */
6 #ifndef __MONO_METADATA_ICALL_INTERNALS_H__
7 #define __MONO_METADATA_ICALL_INTERNALS_H__
9 #include <config.h>
10 #include <glib.h>
11 #include <mono/metadata/object-internals.h>
13 // On Windows platform implementation of bellow methods are hosted in separate source file
14 // icall-windows.c or icall-windows-*.c. On other platforms the implementation is still keept
15 // in icall.c still declared as static and in some places even inlined.
16 #ifdef HOST_WIN32
17 void
18 mono_icall_make_platform_path (gchar *path);
20 const gchar *
21 mono_icall_get_file_path_prefix (const gchar *path);
23 gpointer
24 mono_icall_module_get_hinstance (MonoImage *image);
26 MonoStringHandle
27 mono_icall_get_machine_name (MonoError *error);
29 int
30 mono_icall_get_platform (void);
32 MonoStringHandle
33 mono_icall_get_new_line (MonoError *error);
35 MonoBoolean
36 mono_icall_is_64bit_os (void);
38 MonoArrayHandle
39 mono_icall_get_environment_variable_names (MonoError *error);
41 void
42 mono_icall_set_environment_variable (MonoString *name, MonoString *value);
44 MonoStringHandle
45 mono_icall_get_windows_folder_path (int folder, MonoError *error);
47 void
48 mono_icall_write_windows_debug_string (const gunichar2 *message);
50 gint32
51 mono_icall_wait_for_input_idle (gpointer handle, gint32 milliseconds);
52 #endif /* HOST_WIN32 */
54 // On platforms not using classic WIN API support the implementation of bellow methods are hosted in separate source file
55 // icall-windows-*.c. On platforms using classic WIN API the implementation is still keept in icall.c and still declared
56 // static and in some places even inlined.
57 #if !G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
58 MonoArray *
59 mono_icall_get_logical_drives (void);
61 guint32
62 mono_icall_drive_info_get_drive_type (MonoString *root_path_name);
63 #endif /* !G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
65 gconstpointer
66 mono_lookup_internal_call_full (MonoMethod *method, gboolean warn_on_missing, mono_bool *uses_handles, mono_bool *foreign);
68 MONO_PAL_API void
69 mono_add_internal_call_with_flags (const char *name, const void* method, gboolean cooperative);
71 MONO_PROFILER_API void
72 mono_add_internal_call_internal (const char *name, gconstpointer method);
74 MonoAssembly*
75 mono_runtime_get_caller_from_stack_mark (MonoStackCrawlMark *stack_mark);
77 typedef enum {
78 MONO_ICALL_FLAGS_NONE = 0,
79 MONO_ICALL_FLAGS_FOREIGN = 1 << 1,
80 MONO_ICALL_FLAGS_USES_HANDLES = 1 << 2,
81 MONO_ICALL_FLAGS_COOPERATIVE = 1 << 3
82 } MonoInternalCallFlags;
84 gconstpointer
85 mono_lookup_internal_call_full_with_flags (MonoMethod *method, gboolean warn_on_missing, guint32 *flags);
87 #ifdef __cplusplus
89 #include <type_traits>
91 template <typename T>
92 inline typename std::enable_if<std::is_function<T>::value ||
93 std::is_function<typename std::remove_pointer<T>::type>::value >::type
94 mono_add_internal_call_with_flags (const char *name, T method, gboolean cooperative)
96 return mono_add_internal_call_with_flags (name, (const void*)method, cooperative);
99 template <typename T>
100 inline typename std::enable_if<std::is_function<T>::value ||
101 std::is_function<typename std::remove_pointer<T>::type>::value >::type
102 mono_add_internal_call_internal (const char *name, T method)
104 return mono_add_internal_call_internal (name, (const void*)method);
107 #endif // __cplusplus
109 #endif /* __MONO_METADATA_ICALL_INTERNALS_H__ */