[Mono-dev] [PATCH] New managed code for unmanaged (Win32) resource handling (SRE, PEAPI, MCS)

Paolo Molaro lupus at ximian.com
Thu Mar 9 10:15:25 EST 2006


Please, send the patches as text attachment instead of creating a
compressed archive with a single file in it, thanks.

On 03/03/06 Kornél Pál wrote:
> This patch adds a fully managed and object oriented unmanaged (Win32)
> resource handling internal infractructure to the class library. The most
> important change is that it implements the /resource command line option of
> ilasm in PEAPI.
> 
> I revorked DefineUnmanagedResource and DefineVersionInfoResource methods to
> be fully MS.NET compatible. Including resource blob support.

Could you also provide a regression test suite for all the new features?

Also, please provide also some numbers (like the additional size of
corlib).

As for the runtime part of the patch:
*) why the rename of win32_res to unmanaged_resource? It's just noise,
IMHO

*) You added code like:
+       }
+       else
which is ugly as hell. Please use:
	if (cond) {
		stmt1;
	} else {
		stmt2;
	}

*) do you really need to callback from the C code to reflection to
create the resource data? It should be prepared before.

*) You have code like:
+               assembly->unmanaged_resource_bytes = mono_array_addr (mb->unmanaged_resource_bytes, char, 0);
with :
	char *unmanaged_resource_bytes;
This is incorrect. You can either store the array itself in a field of a
GC-controlled object or the address of one of its elements in a stack
location so that the GC has a chance to see it and not collect or move
the array from under you.

Thanks!
lupus

-- 
-----------------------------------------------------------------
lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better



More information about the Mono-devel-list mailing list