Sunday, August 09, 2009

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.

Tuesday, August 04, 2009

Playing with emacs

I've started playing around with emacs at work and I thought I would keep a list of commonly used commands and plug-ins on my blog.

First off, some plugins that I'm using.

Color-themes is great and allows me a fair bit of selection when it comes to colorizing my editor. ( )

Also, I'm using tabbar.el to give me tab functionality I'd be lost without my tabs. ( )

As for commands, I'll sort them by category.

Files
 C-x C-f                Open a file.
 C-x C-s                Save the file in the current buffer.
 C-x s                  Save all buffers.

Edit
 C-_                    Undo (that's an underscore).
 M-del                  Delete last word.
 C-x del                Delete to beginning of sentence.
 C-t                    Transpose two letters
 M-t                    Transpose two words

 M-d                    Kill a word.
 M-k                    Kill to end of sentence.
 M-z char               Kill up to next occurrence of char.

Searching
 C-s                    Incremental search forward.
 C-s C-s                Cancel forward search.
 C-r                    Incremental search backward.
Buffers
 C-x k                  Kill a specific buffer by name (RET by default kills the current buffer.
 C-x C-q                Flag a buffer as read-only.
 C-x C-b                List buffers