2002-05-20 Martin Baulig <martin@gnome.org>
[mono.git] / mono / metadata / marshal.c
1 /*
2  * marshal.c: Routines for marshaling complex types in P/Invoke methods.
3  * 
4  * Author:
5  *   Paolo Molaro (lupus@ximian.com)
6  *
7  * (C) 2002 Ximian, Inc.  http://www.ximian.com
8  *
9  */
10
11 #include "object.h"
12 #include "loader.h"
13 #include "marshal.h"
14
15 void*
16 mono_marshal_string_array (MonoArray *array)
17 {
18         char **result;
19         int i, len;
20
21         if (!array)
22                 return NULL;
23
24         len = mono_array_length (array);
25
26         result = g_malloc (sizeof (char*) * len);
27         for (i = 0; i < len; ++i) {
28                 MonoString *s = (MonoString*)mono_array_get (array, gpointer, i);
29                 result [i] = s ? mono_string_to_utf8 (s): NULL;
30         }
31         return result;
32 }
33