managed type Mixed (/clr) or Pure (/clr:pure)

B

Bart

Hi,

What is the benefit of using the Pure option over the Mixed one. Is there a
better performance?

We have a lot of stuff in c++ with mfc support en we want to use in our .net
apps. With mixed setting we can compile including the mfc part of our code.
We can get rid of the mfc code but it will cost us some effort so we can use
the pure setting in that case.

If there is not much benefit then we can leave it as it is (sparing us some
couple of days of work).

Thank you in advance.

Bart
 
N

nicolas.hilaire

with /pure option, you can't have unmanaged class or function.
You can't have native code but you have not to be conform CLS (you can
if you want of course).
With this mode, no MFC, no IJW ...
So, the code is faster (because no transition managed/unmanaged).

best regards,

Nico


Bart a écrit :
 
C

Carl Daniel [VC++ MVP]

Bart said:
Hi,

What is the benefit of using the Pure option over the Mixed one. Is there
a better performance?

The primary benefit of using /clr:pure (or /clr:safe) is that you end up
with a verifiable assembly that can be deployed and executed in partial
trust scenarios.

You may (or may not) get some benefit by avoiding native/managed transitions
as well, but that's not really what /clr:pure is about.

-cd
 
B

Bart

Thanks Carl,

You mention the option safe but it looks like i can use some unmanaged code
which makes it not illegible for partial trusted scenario's or am i wrong?
Takes us much less effort to get to this stage of being instead of the pure
one.
 
C

Carl Daniel [VC++ MVP]

Bart said:
Thanks Carl,

You mention the option safe but it looks like i can use some unmanaged
code which makes it not illegible for partial trusted scenario's or am i
wrong? Takes us much less effort to get to this stage of being instead of
the pure one.

If I understand correctly, /clr:safe makes the assembly verifiable, but it
will still require some elevated permissions to run. If you need to run in
the most restrictive environment, then /clr:pure is your answer.

-cd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top