PDA

View Full Version : Using unmanaged class in managed class?


Al6200
03-30-2007, 09:19 PM
I'm working on a C++ project, and I'd like to be able to mix managed and unmanaged code. I'd like to have certain classes unmanaged be accessable in managed functions.

Of note, I'm doing my unmanaged class in an inline header file, which is included using #include.

I tried using #pragma unmanaged, yet that doesn't seem to work. What I'd like to do is make certain parts of my back-end unmanaged and possibly assembly, but have my front-end be done in CLR, which will allow me to use designer mode and textbox controls, etc.

TheColonial
04-08-2007, 04:56 AM
Hi,

What you need to do is tell your compiler to compile the individual files with or without support for the clr.

In Visual Studio, you can specify whether or not you want clr support at the project level and at the file level. The best thing to do is only allow support for the clr in files which will contain managed code, and leave the other files alone. At the project level, do not specify that you want support for the clr.

When you compile your code, it should work fine.

Cheers
OJ