[reflection] Use MonoError in mono_assembly_get_object
[mono.git] / mono / metadata / object.h
index 959c09e49c6314e54e6e0c3be2daf0fc0adc2423..0790764fe28c46cbc41428793bef1634196403bd 100644 (file)
@@ -26,7 +26,7 @@ typedef struct _MonoDynamicImage MonoDynamicImage;
 typedef struct _MonoReflectionMethodBody MonoReflectionMethodBody;
 typedef struct _MonoAppContext MonoAppContext;
 
-typedef struct {
+typedef struct _MonoObject {
        MonoVTable *vtable;
        MonoThreadsSync *synchronisation;
 } MonoObject;
@@ -36,6 +36,7 @@ typedef void*    (*MonoCompileFunc)        (MonoMethod *method);
 typedef void       (*MonoMainThreadFunc)    (void* user_data);
 
 #define MONO_OBJECT_SETREF(obj,fieldname,value) do {   \
+               g_assert (sizeof((obj)->fieldname) == sizeof (gpointer*));      \
                mono_gc_wbarrier_set_field ((MonoObject*)(obj), &((obj)->fieldname), (MonoObject*)value);       \
                /*(obj)->fieldname = (value);*/ \
        } while (0)
@@ -68,7 +69,7 @@ typedef void      (*MonoMainThreadFunc)    (void* user_data);
 MONO_API mono_unichar2 *mono_string_chars  (MonoString *s);
 MONO_API int            mono_string_length (MonoString *s);
 
-MONO_API MonoObject *
+MONO_RT_EXTERNAL_ONLY MONO_API MonoObject *
 mono_object_new                    (MonoDomain *domain, MonoClass *klass);
 
 MONO_API MonoObject *
@@ -127,6 +128,9 @@ mono_string_new_wrapper         (const char *text);
 MONO_API MonoString*
 mono_string_new_len        (MonoDomain *domain, const char *text, unsigned int length);
 
+MONO_API MonoString*
+mono_string_new_utf32      (MonoDomain *domain, const mono_unichar4 *text, int32_t len);
+
 MONO_API char *
 mono_string_to_utf8        (MonoString *string_obj);
 
@@ -136,9 +140,15 @@ mono_string_to_utf8_checked (MonoString *string_obj, MonoError *error);
 MONO_API mono_unichar2 *
 mono_string_to_utf16       (MonoString *string_obj);
 
+MONO_API mono_unichar4 *
+mono_string_to_utf32       (MonoString *string_obj);
+
 MONO_API MonoString *
 mono_string_from_utf16     (mono_unichar2 *data);
 
+MONO_API MonoString *
+mono_string_from_utf32     (mono_unichar4 *data);
+
 MONO_API mono_bool
 mono_string_equal           (MonoString *s1, MonoString *s2);
 
@@ -187,6 +197,9 @@ mono_monitor_try_enter       (MonoObject *obj, uint32_t ms);
 MONO_API mono_bool
 mono_monitor_enter           (MonoObject *obj);
 
+MONO_API void
+mono_monitor_enter_v4        (MonoObject *obj, char *lock_taken);
+
 MONO_API unsigned int
 mono_object_get_size         (MonoObject *o);
 
@@ -245,6 +258,9 @@ MONO_API int
 mono_runtime_exec_main     (MonoMethod *method, MonoArray *args,
                             MonoObject **exc);
 
+MONO_API int
+mono_runtime_set_main_args  (int argc, char* argv[]);
+
 /* The following functions won't be available with mono was configured with remoting disabled. */
 /*#ifndef DISABLE_REMOTING */
 MONO_API void*
@@ -311,6 +327,24 @@ MONO_API uint32_t      mono_gchandle_new_weakref (MonoObject *obj, mono_bool tra
 MONO_API MonoObject*  mono_gchandle_get_target  (uint32_t gchandle);
 MONO_API void         mono_gchandle_free        (uint32_t gchandle);
 
+/* Reference queue support
+ *
+ * A reference queue is used to get notifications of when objects are collected.
+ * Call mono_gc_reference_queue_new to create a new queue and pass the callback that
+ * will be invoked when registered objects are collected.
+ * Call mono_gc_reference_queue_add to register a pair of objects and data within a queue.
+ * The callback will be triggered once an object is both unreachable and finalized.
+ */
+
+typedef void (*mono_reference_queue_callback) (void *user_data);
+typedef struct _MonoReferenceQueue MonoReferenceQueue;
+
+MONO_API MonoReferenceQueue* mono_gc_reference_queue_new (mono_reference_queue_callback callback);
+MONO_API void mono_gc_reference_queue_free (MonoReferenceQueue *queue);
+MONO_API mono_bool mono_gc_reference_queue_add (MonoReferenceQueue *queue, MonoObject *obj, void *user_data);
+
+
+
 /* GC write barriers support */
 MONO_API void mono_gc_wbarrier_set_field     (MonoObject *obj, void* field_ptr, MonoObject* value);
 MONO_API void mono_gc_wbarrier_set_arrayref  (MonoArray *arr, void* slot_ptr, MonoObject* value);