[Mono-dev] [PATCH] New managed code for unmanaged (Win32)resourcehandling (SRE, PEAPI, MCS)
Kornél Pál
kornelpal at hotmail.com
Tue Mar 7 17:17:00 EST 2006
Hi,
> My concern was not about speed, but about reliability. I just don't
> believe it is worthwhile
> to utilize file system when it can be done in memory.
> Are you sure that the filename will be unique even when you run several
> instances of mcs simultaneously ?
Now I understand that we did not understand each other previously regarding
this question.:) I was speaking about .res to resource table conversion
while you were speaking about the resource file generated by mcs.
Several moths ago I wanted to modify GetTempFileName to use a 16-bit suffix
to be fully MS.NET compatible but the result of the debate was to keep the
32-bit one as Linux has a single temp directory while Windows has per-user
temp directories so a 16-bit suffix were possiblie insufficient while a
32-bit is likely to be enough. So I belive that mcs can obtain a unique file
name. If not I think it is GetTempFileName that should be modified.
I prefer using temporary resource files because this way we don't need
non-public Mono-only functionality in SRE as we can use the public
DefineUnmanagedResource method. I think that it's reliable.
> Yes, you can place there any files which you require for your test case.
> It's good practice to use same file name as is name of test file, just
> add some prefix.
OK. Is it OK if I upload some tests for these expected error codes to SVN
before they are available in mcs?
> You are saying that all these files are not used by corlib ?
> ... (file names)
Please have a look at the modified corlib.dll.sources, PEAPI.dll.sources and
mcs.exe.sources and you will see what files are needed by these assemblies.
There are no unnecessary classes included in any of these lists so you can
compare them.
There are some basic, infrastructural classes like ResourceNode and
ResourceStream that are common. PEAPI only uses .res to resource table
conversion classes. mcs only uses .res generation classes with version info
and icon support. SRE is the most compilcated it can convert .res to
resource table and generate version info resource but that version info
resource is a bit different than the one that is generated by mcs. So SRE
has no icon support that means that mcs uses about 7 files that are not used
by SRE. And of course a lot of files used by SRE are not required by mcs
that are about 14 files.
Note that unlike mcs that has a lot of classes in a single file I followed
one class per source file desing in Mono.UnmanagedResources this is why
there are so many source files.
> I just don't know what these x8 and X8 strings are. If you declare
> constant with some explanatory name
> it will be easier to understand what they are used for.
These are standard numeric format strings so I don't think they should be
documented or explained using constants. x8 is the number in hexadecimal
with 8 digits at least (zero padded) in lower case. X8 is the same in upper
case.
As these format strings are passed directly to int.ToString() it isn't
cryptic. I belive that these format strings are self-explanatory. I think
providing some explanation is like providing explanation for {0}in
string.Format("some {0} inserted", "text").
For more information please refer to
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconstandardnumericformatstrings.asp
Kornél
More information about the Mono-devel-list
mailing list