[Mono-dev] Create a 'MonoImage' from a byte array. (corrected)

Robert Jordan robertj at gmx.net
Wed Jun 16 12:40:30 EDT 2010


On 16.06.2010 17:49, Thiago Padilha wrote:
>   I'm trying to create a MonoImage/MonoAssembly from a byte array like this :
>
>
> //body omited, this is a simple function that return contents of a
> binary file and returns the file size in bytes as an out parameter
> static char *read_file_contents(char *fullpath, int *outfilesize);
>
> static char *getfullpath(char *name); //returns the full path of a file
>
> static MonoImage *get_image(char *data, char *name, char *size)
> {
>         return  mono_image_open_from_data_with_name (data, size, 0,
> MONO_IMAGE_OK, 0, name);

Please check the prototype of mono_image_open_from_data_with_name():
instead of MONO_IMAGE_OK you're supposed to pass a ptr to
a MonoImageOpenStatus enum.

You should really consider increasing the warning level of
your compiler or at least pay attention to the warnings.

Robert



More information about the Mono-devel-list mailing list