zoukankan      html  css  js  c++  java
  • C++/CLI Boxing/UnBoxing and Ref/Out Issue

    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.
     

     

  • 相关阅读:
    网络协议 22
    网络协议 21
    网络协议 20
    网络协议 19
    网络协议 18
    网络协议 17
    网络协议 16
    网络协议 15
    网络协议 14
    .net 4.0 中的特性总结(五):并行编程
  • 原文地址:https://www.cnblogs.com/taoxu0903/p/2023791.html
Copyright © 2011-2022 走看看