On Thu, 12 Jun 2008 17:14:24 -0700, Bit Byte <ro**@yourbox.comwrote:
I have legacy code I wrote in C (and some C++). What is the recommended
way to use my legacy code from C# ?
It really depends on the code. IMHO, the best way is to just port it and
abandon the original. :)
But sometimes you'd prefer to stick with the original (for example, it's
still used elsewhere and you only want to maintain one code base).
In that case, your two main options are to compile it to a DLL and use
p/invoke, or wrap the code in managed C++ and produce a managed DLL
directly usable from C#. The latter is basically the same as the former,
but more explicit. In other words, it could be more work, but you have
more control over the resulting interface too.
Pete