.NET Interoperability Exercises and Solutions

August 1, 2008

no comments

I recently delivered a half-day instructor-led training on .NET Interoperability, including P/Invoke, COM Interop and C++/CLI.  I’m sharing the exercises and solutions with you in the hope you might find them useful.  All the exercises are taken from (almost) real-life scenarios I had to implement at some point in the past.

Among the exercises:

  • Wrap System.IO.FileSystemWatcher for use from native C++ code
  • Provide a managed class that acts as a byte array allocated from a Win32 low-fragmentation heap (LFH)
  • Expose System.Text.RegularExpressions.Regex to clients through COM interop and consume it from VBScript

The exercises and solutions can be downloaded from my SkyDrive.

With the advent of Windows Vista, Windows Server 2008 and the soon-expected Windows 7, the need for interoperability solutions is becoming clearer than ever before – most of the system APIs have no managed counterparts and wrapping them properly becomes a means to implementing any kind of solution on top of Windows.  Hopefully, community efforts and Microsoft investments will provide an exhaustive managed layer of some form for current and future versions of Windows.

Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>