Virtual bool bug in VS2005 ?

  • Thread starter Thread starter Kevin Frey
  • Start date Start date
K

Kevin Frey

Hello,

Does anyone know if the "virtual bool bug" is still present in VS2005 when
calling between managed and unmanaged code?

Thanks

Kevin
 
Kevin said:
Hello,

Does anyone know if the "virtual bool bug" is still present in VS2005
when calling between managed and unmanaged code?

No, it's fixed.

-cd
 
Hi Arnaud!
The good question being : where has it been fixed? In the compiler or in the
..NET runtime ;-)

The compiler was not the problem... the problem occured during the
unmanaged-to-managed transition, so it must be fixed in the .NET-Framework.
For the VC7(.1) bug see:
http://www.codeproject.com/buglist/virtualboolbug.asp

I just can remember the reason for this bug: The compiler and the
framework team discussed who should solve the problem (and then they
forgot to solve it :-) )

The CLR team said the "bool(ean)" is 4 bytes and the C++-teams says
"bool" is 1-byte.
And I think it was hard for the C++-team to change the size of bool from
1 to 4 ;-)

Therefor the C++-team has done everything correct...


So for VC8 the C++-team still just set the lower 8-bit of the
EAX-register (called AL).
And the conversion from AL to EAX (1-byte to 4-byte) is done by the
..NET-Framework (mscorwks!PInvokeCalliPostCall).

So the CLR-team has done the conversion...


PS: But for the VC7.1 bug it seems that the C++-team had to solve the
bug (see: http://support.microsoft.com/kb/823071/en-us)

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
 
Jochen said:
Hi Arnaud!
Hello Jochen,
The compiler was not the problem... the problem occured during the
unmanaged-to-managed transition, so it must be fixed in the .NET-Framework.
For the VC7(.1) bug see:
http://www.codeproject.com/buglist/virtualboolbug.asp

I just can remember the reason for this bug: The compiler and the
framework team discussed who should solve the problem (and then they
forgot to solve it :-) )

Yep : that's why I ask the question ;-)
The CLR team said the "bool(ean)" is 4 bytes and the C++-teams says
"bool" is 1-byte.
And I think it was hard for the C++-team to change the size of bool from
1 to 4 ;-)

What is really strange (with framework 1.0 and 1.1) is that, during the
transition return from unmanaged to managed, if the 3 upper bytes of
EAX are !=0, then the framework sets EAX=0x1 (at least, it is how I
have understood the problem...)

Arnaud
MVP - VC
 
Hi adebaene
What is really strange (with framework 1.0 and 1.1) is that, during the
transition return from unmanaged to managed, if the 3 upper bytes of
EAX are !=0, then the framework sets EAX=0x1 (at least, it is how I
have understood the problem...)

Thats not strange, thats the conversion from "4-byte-value" to
"System::Boolean"...

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
 
Back
Top