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.
The toolkit contains the following things:
- A command-line tool for managed-to-unmanaged signature conversion
- A command-line tool for unmanaged-to-managed signature conversion
- A GUI tool combining all the conversion functionality
- An XML database file containing Windows API signature data (referenced from VS2005 SDK)
- A help manual
To use the tool, you either feed in an MSIL assemblies and get out C source for the proper unmanaged signatures or feed in C source with the unmanaged signature and get out proper VB/C#. The command-line tools allows batch processing for multiple files.
More information about the P/Invoke Interop Assistant can be found in the help mannual attached with the release package.