[quoted text, click to view] "Marty" <xmarty99@hotmail.com> wrote in message
news:bMlRd.74885$L_3.20142@clgrps13...
> Can I mix my managed code within my unmanaged code?
Yes, you have a couple of options.
[quoted text, click to view] > Just for instance, I have a socket class that is managed code. It is
> include in my unmanaged VC++ project and it compile.
>
> The point is, when I want to instantiate my class, I still get this error:
> fatal error C1190: managed targeted code requires '#using <mscorlib.dll>'
> and '/clr' option
The simplest thing to do is to set your unmanaged prooject properties so
that it compiles with the /CLR switch:
Project->Properties
from the menu
Click on the Configuration Properties folder and select General and then
scroll down to use Managed Extensions in the right pane.
Then in a module where you want to use both modes, use this to separate the
managed and unmanaged functions
#using <mscorlib.dll>
#pragma unmanaged
.
.
.
#pragma managed
.
.
.
If you are a COM junkie, from manged code you can treat your .Net components
as COM objects. See this for the details:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconpackagingassemblyforcom.asp
If you do that, the client of your object won't be required to be
implemented in managed code.
Regards,
Will