[Mono-dev] Create a 'MonoImage' from a byte array.
Tom Spink
tspink at gmail.com
Wed Jun 16 11:51:40 EDT 2010
Hi, I don't think you've told us the problem!
Tom.
On 6/16/10, Thiago Padilha <tpadilha84 at gmail.com> 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 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);
> }
>
> MonoAssembly *get_assembly_from_file(char *name)
> {
> int size = 0;
>
>
>
> MonoAssembly *ret = NULL;
> MonoImage *image = get_image_from_file(fullpath);
>
> if(image != NULL)
> ret = mono_assembly_load_from_full(image, fullpath, MONO_IMAGE_OK, 0);
>
>
> free(fullpath);
> return ret;
> }
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
--
Sent from my mobile device
Tom Spink
More information about the Mono-devel-list
mailing list