First contact with C ++CLI

xiaoxiao2021-03-06  80

I bought the topic of this issue ~ I am very interested in the topic of C / CLI. After all, I like C . I wrote a simple .NET Class Library, compiled ... Compile-compiled test code is fun compiler Will automatically detect whether the function in the relevant non-host Class has a part of the .NET is not compatible. If you have any, you can compile another non-.net

The module is going. (This time doesn't see this function with Refletor).

C # a call example of writing (simple extraction important part ~)

Void foo () {Testall all; cout << "HelloWorld!" << endl; all.foo ();

Class testall {void foo () {__ASM {MOV AX, 26}}}

Compiled into public unsafe void foo () {testall all1; .std.basic_ostream >. << ( .std.

Operator <<< Struct std :: char_traits >> ((Basic_OStream >> *

Modopt (iscxxreferencemodifier) ​​& .std.cout, & . ?? _ c @ _0n @ bopnljff @ hello? 5World?

$ C? $ Aa @), (Basic_OStream > * modopt (iscxxreferenceModifier)

MODOPT (CallConvcdecl) * (Basic_OStream > * modopt

IscxxreferenceModifier))) .__ unep @? Endl @ std @@ $$ fyaaav? $ Basic_OStream @ du?

$ char_traits @ d @STD @@ @ @@ @@ z); .newcpp.testall.foo ((Testall * Modopt (IsconstModifier) ​​ModOpt (IsconstModifier)

& all1);

Definition in compiled Assembly [PreserveSig, MethodImpl ((MethodImploptions) 1) | MethodImploptions.unmanaged,

SuppressunmanagedCodeSecurity] public static unsafe void modopt (callconvthiscall) newcpp.testall.foo (Testall * modopt

ISconstModifier) ​​Modopt (isconstModifier);

It can be seen that the C / CLI run is also based on .NET architecture. Regarding the resources occupied by the program, the non-hosting part may also be composed to the traditional Native C

Differentiated. Includes infrastructure such as traditional code segments, piles, stacks. C / CLI is provided in a .NET plugin. Its purpose should be to let "Net can use C function and resources" instead of convenience

C service using .NET framework

转载请注明原文地址:https://www.9cbs.com/read-95524.html

New Post(0)