Merge pull request #2408 from tastywheattasteslikechicken/MoreInterfaceSupport
[mono.git] / samples / embed / test-invoke.c
index a1c5cd7da05dbe5c073e56cd7d8400376a5e1e41..9d53716957513a48a04ade4b7fee8df99e8db224 100644 (file)
@@ -6,11 +6,15 @@
 #include <string.h>
 #include <stdlib.h>
 
+#ifndef FALSE
+#define FALSE 0
+#endif
+
 /*
  * Simple mono embedding example.
  * We show how to create objects and invoke methods and set fields in them.
  * Compile with: 
- *     gcc -Wall -o test-invoke test-invoke.c `pkg-config --cflags --libs mono` -lm
+ *     gcc -Wall -o test-invoke test-invoke.c `pkg-config --cflags --libs mono-2` -lm
  *     mcs invoke.cs
  * Run with:
  *     ./test-invoke invoke.exe
@@ -75,7 +79,7 @@ access_reference_field (MonoObject *obj)
        p = mono_string_to_utf8 (strval);
        printf ("Value of str is: %s\n", p);
        /* we need to free the result from mono_string_to_utf8 () */
-       g_free (p);
+       mono_free (p);
 
        /* string are immutable, so we need to create a different string */
        strval = mono_string_new (domain, "hello from the embedding API");
@@ -98,8 +102,8 @@ call_methods (MonoObject *obj)
        MonoObject *result, *exception;
        MonoString *str;
        char *p;
-       gpointer iter;
-       gpointer args [2];
+       void* iter;
+       void* args [2];
        int val;
 
        klass = mono_object_get_class (obj);
@@ -163,7 +167,7 @@ call_methods (MonoObject *obj)
        p = mono_string_to_utf8 (str);
        printf ("Value of str from property is: %s\n", p);
        /* we need to free the result from mono_string_to_utf8 () */
-       g_free (p);
+       mono_free (p);
 
        /* Now we'll show two things:
         * 1) static methods are invoked with mono_runtime_invoke () as well,
@@ -204,7 +208,7 @@ call_methods (MonoObject *obj)
        p = mono_string_to_utf8 (str);
        printf ("Values of str/val from Values () are: %s/%d\n", p, val);
        /* we need to free the result from mono_string_to_utf8 () */
-       g_free (p);
+       mono_free (p);
 }
 
 static void
@@ -240,7 +244,7 @@ more_methods (MonoDomain *domain)
        p = mono_string_to_utf8 (str);
        printf ("25.ToString (): %s\n", p);
        /* we need to free the result from mono_string_to_utf8 () */
-       g_free (p);
+       mono_free (p);
 
        /* Now: see how the result is different if we search for the ToString ()
         * method in System.Object: mono_runtime_invoke () doesn't do any sort of
@@ -254,7 +258,7 @@ more_methods (MonoDomain *domain)
        p = mono_string_to_utf8 (str);
        printf ("25.ToString (), from System.Object: %s\n", p);
        /* we need to free the result from mono_string_to_utf8 () */
-       g_free (p);
+       mono_free (p);
 
        /* Now get the method that overrides ToString () in obj */
        vtmethod = mono_object_get_virtual_method (obj, method);