P/Invoke Interop Assistant - Overview

Windows SigGen

P/Invoke Interop Assistant - Overview

Tricky marshaling rules make Interop an advanced feature that many developers struggle with. This is especially true for Platform Invocation Services which, unlike COM Interop that uses Tlbimp, do not provide any automated way of generating managed proxy entry points based on some formal description of the unmanaged side. Developers end up declaring the entry points manually, often just trying to guess the signatures on a trial-and-error basis until their particular scenario seems to work. As often as not, this method of generating PInvoke signatures results in insidious bugs such as memory corruption or unexpected product behavior, that do not get caught until late into the product cycle, if at all.

The P/Invoke Interop Assistant provides automatic generation of managed code from C headers as well as the reverse generation of unmanaged signatures based on managed inputs. Users can take advantage of the tools to easily generate Windows and custom managed entry points and verify that the stack layout produced by the marshaler at runtime will really match what is expected by the unmanaged side. The SigExp is also capable of providing additional information such as memory allocation and marshaling details.

The Assistant is supported on Windows XP SP2, Windows Vista and above. It comprises of two tools that complement each other:

SigImp: Unmanaged to Managed Signature Converter SigExp: Managed to Unmanaged Signature Converter

If you have any suggestion about the tool, want to file bugs or give your comments, please send email to [email protected].