dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[DotGNU]another bug in pnet


From: Paolo Molaro
Subject: [DotGNU]another bug in pnet
Date: Sat, 11 Jan 2003 13:48:28 +0100
User-agent: Mutt/1.4i

A few days ago Marcus pointed out an issue in running the Qt#
dll compiled with pnet on mono (well, there were really three issues,
the other two has already been corrected in the pnet cvs).
This specific issue is logged here:
http://bugzilla.ximian.com/show_bug.cgi?id=36373
Basically mono throws an exception when it attempts to use
QNull defined in Qt.dll.
I first thought it was a bug in mono, but it turns out it's a bug in
pnet. QNull is a valuetype and as such it needs to have a size > 0.
I'm sure this is in the spec somewhere, I'm too lazy to look it up, but
think about it: a valuetype is allocated on the stack, or as a field,
it _needs_ to have a non-zero size.
The sample program is something like:

using System;

struct QNull {
        public override string ToString () {
                return "Qnull";
        }
        static void Main () {
                QNull qn = new QNull ();
                Console.WriteLine ("got '{0}'", qn);
        }
};

I compiled it with cscc from a few weeks ago (cvs pnet doesn't compile,
missing numformat.c file). Since programs compiled with cscc don't run
with the MS runtime, I diasassembled it with pnet's ildasm and assembled
it with MS'ilasm.
You'll get the following error:
[MD]: Error: Value class has neither fields nor size parameter.
[token:0x02000002]
1 Errors Verifying pnet-vt.EXE

The MS runtime still runs the code (_if_ you run it with full-privileges), 
I assumes it internally corrects the issue and sets the size to 1 (we'll do 
something like that in mono).

lupus

-- 
-----------------------------------------------------------------
address@hidden                                     debian/rules
address@hidden                             Monkeys do it better


reply via email to

[Prev in Thread] Current Thread [Next in Thread]