您的位置:首页 > 编程语言 > C语言/C++

C++/CLI Boxing/UnBoxing and Ref/Out Issue

2011-04-21 17:15 399 查看
1. Boxing and UnBoxing in C++/CLI

int^ hi = 123;
int c = *hi;
2. Use C# functions with ref/out arguments in C++/CLI

If the argument is dotNet value type, then directly create an instance of it on stack in C++/CLI and pass it when calling the C# function;

if the argument is dotnet ref type,then create a handle of that type and initialize it, and pass it.

More:

c++/cli uses c# module functions having arguments "ref xx", "out xx"
----the C++/CLI code
void foo(Bar^% x);
transforms into
Void foo(ref Bar x);
---The concept of out is for the most part limited to C#. The CLR really only sees ref parameters. The out concepts is achieved via a mod opt I believe and most languages ignore it.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: