我们有一个用于CLR的VC ++项目,它在VS 2012中正确编译。但是在运行时获得以下异常:
“无法加载类型'System.Int32 []&'来自assembly'mscorlib,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'“
以下是代码:
// ClassLibrary1.h
#pragma once
using namespace System;
using namespace System::Runtime::InteropServices;
namespace ClassLibrary1 {
//template <typename T>
class ArgOutValueArray
{
public:
ArgOutValueArray(int (__gc* __nogc& aRef) __gc[] )
{
//(*x)[0] = 100;
}
};
public __gc class Class1
{
public:
static void f1([Out] int (*x) __gc[])
{
f2(x);
}
static void f2([Out] int (*x) __gc[])
{
ArgOutValueArray arg_xeqp(x); // Getting the exception at this line.
}
};
}