Mixing managed and unmanaged code
-
Suppose I have an old application with unmanaged code and I adding some .NET classes that are of course managed. The question is: Will my unmanaged code be compiled as native code and the managed code will be CLR metadata? I am asking this, because I want my old, unmanaged part of application to be very fast, not a MSIL that is at first run (?) compiled into native code. Best regards, Alexandru Savescu
-
Suppose I have an old application with unmanaged code and I adding some .NET classes that are of course managed. The question is: Will my unmanaged code be compiled as native code and the managed code will be CLR metadata? I am asking this, because I want my old, unmanaged part of application to be very fast, not a MSIL that is at first run (?) compiled into native code. Best regards, Alexandru Savescu
Use #pragma unmanaged to specify that the following code is to be compiled to native code and #pragma managed when you end the native stuff
Author of the romantic comedy Summer Love and Some more Cricket [New Win] Buy it, read it and admire me :-)
-
Use #pragma unmanaged to specify that the following code is to be compiled to native code and #pragma managed when you end the native stuff
Author of the romantic comedy Summer Love and Some more Cricket [New Win] Buy it, read it and admire me :-)
Thanks Nish! However what if I want to declare a managed type inside of an existing class? Will then my whole class be managed? (This is something that I would not like :) ) Best regards, Alexandru Savescu
-
Thanks Nish! However what if I want to declare a managed type inside of an existing class? Will then my whole class be managed? (This is something that I would not like :) ) Best regards, Alexandru Savescu
****Alexpro wrote: Will then my whole class be managed? (This is something that I would not like ) No. If you want to use a managed type inside say your CDialog class, then you'll have to only add #pragma managed for the function in the class, where you use the managed type. That was how it was in Beta 2. I didn't chk to see if it allows you to have a managed line of code inside an unmanaged marked function. I should think not! Nish
Author of the romantic comedy Summer Love and Some more Cricket [New Win] Buy it, read it and admire me :-)
-
Nish - Native CPian wrote: if it allows you to have a managed line of code inside an unmanaged marked function. I should think not! It doesn't! Best regards, Alexandru Savescu
****Alexpro wrote: It doesn't! Well, at least, they granularised at the function level instead of at the class level which would have been horrible. Nish :-)
Author of the romantic comedy Summer Love and Some more Cricket [New Win] Buy it, read it and admire me :-)
-
****Alexpro wrote: Will then my whole class be managed? (This is something that I would not like ) No. If you want to use a managed type inside say your CDialog class, then you'll have to only add #pragma managed for the function in the class, where you use the managed type. That was how it was in Beta 2. I didn't chk to see if it allows you to have a managed line of code inside an unmanaged marked function. I should think not! Nish
Author of the romantic comedy Summer Love and Some more Cricket [New Win] Buy it, read it and admire me :-)
Nish - Native CPian wrote: if it allows you to have a managed line of code inside an unmanaged marked function. I should think not! It doesn't! Best regards, Alexandru Savescu