我正在使用C++ CLR来包装本机C++ DLL.这样C#CLR dll就可以被C#项目访问了.
问题是,当我想将一个byte []返回给C#,并在CLR中写入这样的代码时:
static System::Byte[]^ GetTestByteBuffer()
{
System::Byte[]^ byte = gcnew System::Byte[128];
return byte;
}
Run Code Online (Sandbox Code Playgroud)
但它无法通过编译.有人可以帮帮我吗?
编译错误:
error C3409: empty attribute block is not allowed
error C3409: empty attribute block is not allowed error C2146: syntax error "^":
error C2334: unexpected token(s) preceding '{'; skipping apparent function
Run Code Online (Sandbox Code Playgroud)
Jef*_*eff 29
这是在C++/CLI中声明字节数组的方式:
array<System::Byte>^
Run Code Online (Sandbox Code Playgroud)
谷歌是你的朋友......