C++ C# Interoperability

Three complementary technologies enable these managed/unmanaged interactions:

1.
Platform Invoke (sometimes referred to as P/Invoke) enables calling any function in any unmanaged language as long as its signature is redeclared in managed source code. This is similar to the functionality that was provided by the Declare statement in Visual Basic® 6.0.

2.
COM interop enables calling into COM components in any managed language in a manner similar to using normal managed components, and vice versa. COM interop is comprised of core services provided by the CLR, plus some tools and APIs in the System.Runtime.InteropServices namespace.

3.
C++ interop (sometimes referred to as It Just Works (IJW)) is a C++-specific feature, which enables flat APIs and COM APIs to be used directly, as they have always been used. This is more powerful than COM interop, but it requires much more care. Make sure that you check the C++ resources before you use this technology.

Ref:

1. PInvoke Interop Assistant -
Brief: In marshalling, there are a bunch of attributes and rules. Understanding all those attributes and rules seem a bit daunting. In order to make developing work more efficient and easier on those attributes and the rules, P/Invoke Interop Assistant comes out. It is a toolkit that helps developers to efficiently convert from C to managed P/Invoke signatures or verse visa. This is conceptually similar to TlbImp for COM Interop which generates managed proxy entry points based on some formal description of the unmanaged side but it works for P/Invoke. The toolkit was first released on MSDN Magazine website in Jan, 2008.

http://www.codeplex.com/clrinterop/Release/ProjectReleases.aspx?ReleaseId=14120

2. P/Invoke sample code msi -
http://msdn.microsoft.com/en-us/library/aa719104.aspx

3.CLR INSIDE OUT -

http://msdn.microsoft.com/en-us/magazine/cc164193.aspx

4.NET to C++ Bridge -

http://blogs.microsoft.co.il/blogs/sasha/archive/2008/02/16/net-to-c-bridge.aspx

5. Interoperability Mini-Guide -
http://tssblog.techtarget.com/index.php/interviews/interoperability-bridging-net-and-java/

6. Calling Win32 DLLs in C# with P/Invoke -
http://msdn2.microsoft.com/en-us/magazine/cc164123.aspx

7. P/Invoke Revisited -
http://msdn2.microsoft.com/en-us/magazine/cc163910.aspx

8. Is PInvoke dead -
http://weblogs.asp.net/kennykerr/archive/2005/06/20/Is-P_2F00_Invoke-Dead_3F00_.aspx

9. An Overview of Managed/Unmanaged Code Interoperability -
http://msdn2.microsoft.com/en-us/library/ms973872.aspx

10. Chris Green's Unix/Windows and .Net/Java Interoperability Blog -
http://blogs.msdn.com/chris.green/

11. Design Guidelines, Managed code and the .NET Framework -
http://blogs.msdn.com/brada/articles/361363.aspx