Hi Sergey!
> void testClass::TestMethodEnum([OutAttribute] Els (*outParam)[])
> {
[quoted text clipped - 3 lines]
> (*outParam) = Els::Crash;
> }
You should replace the line
(*outParam) = Els::Crash;
with
(*outParam)[i] = Els::Crash;

Signature
Greetings
Jochen
My blog about Win32 and .NET
http://blog.kalmbachnet.de/
mapi33dev - 06 Jun 2005 15:05 GMT
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 --------------------------