2004-12-29 Martin Baulig <martin@ximian.com>
[mono.git] / mono / metadata / object.h
index 2413cc7a346727372949fc020f72ca13b0b576cd..b8aa360a05d0e7dcc944e4b45c1a8b0cdead6b01 100644 (file)
@@ -18,6 +18,7 @@ typedef struct _MonoThreadsSync MonoThreadsSync;
 typedef struct _MonoThread MonoThread;
 typedef struct _MonoDynamicAssembly MonoDynamicAssembly;
 typedef struct _MonoDynamicImage MonoDynamicImage;
+typedef struct _MonoReflectionMethodBody MonoReflectionMethodBody;
 
 typedef struct {
        MonoVTable *vtable;
@@ -53,7 +54,7 @@ typedef void      (*MonoMainThreadFunc)    (gpointer user_data);
 #define mono_object_domain(obj) (((MonoObject*)(obj))->vtable->domain)
 
 #define mono_array_length(array) ((array)->max_length)
-#define mono_array_addr(array,type,index) ( ((char*)(array)->vector) + sizeof (type) * (index) )
+#define mono_array_addr(array,type,index) ((type*) mono_array_addr_with_size (array, sizeof (type), index))
 #define mono_array_addr_with_size(array,size,index) ( ((char*)(array)->vector) + (size) * (index) )
 #define mono_array_get(array,type,index) ( *(type*)mono_array_addr ((array), type, (index)) ) 
 #define mono_array_set(array,type,index,value) \
@@ -78,6 +79,9 @@ mono_object_new_fast      (MonoVTable *vtable);
 MonoObject *
 mono_object_new_alloc_specific (MonoVTable *vtable);
 
+void*
+mono_class_get_allocation_ftn (MonoVTable *vtable, gboolean *pass_size_in_words);
+
 MonoObject *
 mono_object_new_from_token  (MonoDomain *domain, MonoImage *image, guint32 token);
 
@@ -252,7 +256,20 @@ mono_property_set_value (MonoProperty *prop, void *obj, void **params, MonoObjec
 MonoObject*
 mono_property_get_value (MonoProperty *prop, void *obj, void **params, MonoObject **exc);
 
-/* GC handles support */
+/* GC handles support 
+ *
+ * A handle can be created to refer to a managed object and either prevent it
+ * from being garbage collected or moved or to be able to know if it has been 
+ * collected or not (weak references).
+ * mono_gchandle_new () is used to prevent an object from being garbage collected
+ * until mono_gchandle_free() is called. Use a TRUE value for the pinned argument to
+ * prevent the object from being moved (this should be avoided as much as possible 
+ * and this should be used only for shorts periods of time or performance will suffer).
+ * To create a weakref use mono_gchandle_new_weakref (): track_resurrection should
+ * usually be false (see the GC docs for more details).
+ * mono_gchandle_get_target () can be used to get the object referenced by both kinds
+ * of handle: for a weakref handle, if an object has been collected, it will return NULL.
+ */
 guint32      mono_gchandle_new         (MonoObject *obj, gboolean pinned);
 guint32      mono_gchandle_new_weakref (MonoObject *obj, gboolean track_resurrection);
 MonoObject*  mono_gchandle_get_target  (guint32 gchandle);