How does C ++ / cli work internally with unmanaged parts?

How it works? Does it have separate parts — some methods are managed, some are unmanaged, does each method convert to a managed one, trying to maintain all control and make interaction calls when it should?

+3
source share
1 answer

There are three different compilers associated with creating managed code in C ++ / CLI:

/clr:pureforces the compiler to produce MSIL code. Unmanaged functions are not allowed (everything is compiled in MSIL). This mode is similar to unsafeC # code . In this mode, you can use CRT there a clean version of MSIL. Collections compiled in this mode cannot be used in partial trust environments that require verifiable code (for example, some hosted SQL Server assemblies).

/clr:safeforces the compiler to prepare verifiable MSIL code similar to the C # compiler. C ++ is not allowed. You can run assemblies /clr:safein partial trust environments where validation is performed by a security policy.

/clr . MSIL, . , , . , .

, "" . pure safe. , , MSIL, . . . , .

+5

Source: https://habr.com/ru/post/1718610/


All Articles