Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / October 2005

Tip: Looking for answers? Try searching our database.

Virtual bool bug in VS2005 ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kevin Frey - 26 Oct 2005 01:32 GMT
Hello,

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

Thanks

Kevin
Carl Daniel [VC++ MVP] - 26 Oct 2005 06:06 GMT
> 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
Arnaud Debaene - 26 Oct 2005 07:07 GMT
>> 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.

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

Arnaud
MVP - VC
Jochen Kalmbach [MVP] - 26 Oct 2005 07:46 GMT
Hi Arnaud!

>>>Does anyone know if the "virtual bool bug" is still present in VS2005
>>>when calling between managed and unmanaged code?
[quoted text clipped - 3 lines]
> 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)

Signature

Greetings
  Jochen

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

adebaene@club-internet.fr - 26 Oct 2005 09:28 GMT
> Hi Arnaud!
Hello Jochen,

> > The good question being : where has it been fixed? In the compiler or in the
> > ..NET runtime ;-)
[quoted text clipped - 7 lines]
> 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
Jochen Kalmbach [MVP] - 26 Oct 2005 09:45 GMT
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"...

Signature

Greetings
  Jochen

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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.