Re: Compiler bug in VC++ .Net 2003

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi Jochen

Of course this line is :
(*outParam)[i] = Els::Crash;

BUT FORUM WEB UI REPLACES IT TO SMILE :-((

-------------------------------- test.h --------------------------
#pragma once

using namespace System::Runtime::InteropServices;

#define V_OK 17235968
#define V_HALT 17235969
#define V_CRASH 17235970

namespace managedC
{
public __value enum Els : unsigned int
{
Ok = V_OK,
Halt = V_HALT,
Crash = V_CRASH
};
public __gc class testClass
{
public:
static void TestMethodEnum([OutAttribute] Els (*outParam)[]);
};
}
-------------------------------- test.h --------------------------
-------------------------------- test.cpp --------------------------
#include "test.h"

#using <mscorlib.dll>

namespace managedC
{
void testClass::TestMethodEnum([OutAttribute] Els (*outParam)[])
{
*outParam = new Els[2];

for(int i = 0; i < (*outParam)->Length; i++)
(*outParam)[i] = Els::Crash;
}
}
-------------------------------- test.cpp --------------------------
-------------------------------- test.cs --------------------------
using System;
using System.Collections;

using managedC;

namespace marshalBug
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
for(int i = 0; ; i++)
{
Els[] paramEnum;
testClass.TestMethodArray(out paramEnum);

foreach(Els t in paramEnum)
Console.WriteLine(t);

GC.Collect();
}
}
}
}
-------------------------------- test.cs --------------------------

.



Relevant Pages

  • Re: facing problem during compilation
    ... reserved namespace if your header name happens to start with 'e', ... since identifiers starting with an upper-case 'E' followed by another ... upper-case letter are reserved as errno macros. ... #pragma once ...
    (comp.lang.c)
  • Re: Function in header file - newbie VC++/CLI
    ... #pragma once ... using namespace System; ... /// 'Resource File Name' property for the managed resource compiler tool ...
    (microsoft.public.vc.language)
  • Compiler bug in VC++ .Net 2003
    ... The following code always crashes any .Net appication that uses it. ... #pragma once ... public __gc class testClass ...
    (microsoft.public.dotnet.languages.vc)
  • Microsoft make brain bleed
    ... using namespace System; ... #pragma region Windows Form Designer generated code ... MyClass instance; ... I want to have the event handler for button 1 execute ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Event ID 9097 WMI Error..
    ... #pragma autorecover ... All rights reserved. ... //*** Creates namespace for WMI ...
    (microsoft.public.exchange2000.admin)