Mixing CLR and non-clr code

So, I'm trying to get back into playing around with my "Wanton" codebase (some editor stuffs I want to do) and I ran into a problem that I've experienced in the past before, but didn't get an adequate solution for in the past.

So, in some libraries I'm creating I needed to mix in some engine based code (my Wanton codebase) into the editor. It's fairly native C/C++ code. As soon as I included it, I got the following error:


Very odd, to say the least. Here's how I was invoking the headers:


I've had issues in the past where the 'using' statement caused me grief, so I figured I'd move my header declarartions above them, a la:


Lo and behold, that did it (compiles and runs fine).

Digging around the net brought up this little gem:

http://social.msdn.microsoft.com/forums/en-US/vclanguage/thread/18e7ab00-743f-497e-b340-cd2fd333a773

The short and sweet of it?
If you add using namespace System::Windows::Forms; before including Visual C++ will be confused because IDataObject is also a managed interface in System::Windows::Forms. You can relegate windows.h declarations to a lower namespace:
inamespace Win32{#include };and reference windows.h symbols with the Win32 namespace prefix, or move all using statements from .h to .cpp and add a namespace prefix when an ambiguous symbol is used.

Just something I thought I would share with the populace at large.

Comments

Popular Posts