MC++ FAQ
Wednesday 04 | 16 | 2003
Bug involving unmanaged virtual member methods returning bool
There is an often encountered problem that manifests itself when managed code calls an unmanaged virtual member method of a __nogc class that returns a bool. Here's some sample code that repros the problem:
#using <mscorlib.dll>
using namespace System;

#pragma unmanaged

class U
{
public:
  virtual bool ReturnsFalse() { return false; }
};

#pragma managed

int main(void)
{
  U *um = new U();
  if ( um->ReturnsFalse() )
    Console::WriteLine(S"Arghh!!!!");
  else
    Console::WriteLine(S"Everything Ok...");

  return 0;
}

This is a known problem, but has not been corrected in Visual C++.NET 2003 RTM.

Reports of this problem can be found here and here.

Posted by tomasr at April 16, 2003 01:52 PM
Comments
Post a comment
Name:


Email Address:


URL:


Comments:


Remember info?

Copyright(C) 2002, Tomas Restrepo, All rights reserved. Powered by Movable Type 2.63