Search code examples
c#.netpinvokeunmanagedfunction-signature

Is there a tool that generates P/Invoke signatures for arbitrary unmanaged DLL?


I stumbled upon a tool that generates P/Invoke signatures for Microsoft's own unmanaged DLLs: PInvoke Interop Assistant

Is there a similar tool that will generate P/Invoke signatures for third-party unmanaged DLLs?

Alternately, any way to feed a third-party DLL to PInvoke Interop Assistant

EDIT: Actual issue I am trying to resolve


Solution

  • Google quickly found http://www.pinvoker.com (Wayback) (Compatiblity listed as VS2005, 2008, and 2010; it doesn't seem to have been updated to work with newer versions)

    Microsoft's C++/CLI compiler can also do this, if you use /clr:safe and #include the header file, it will generate p/invoke code which you can extract with e.g. ILSpy (free) or Red Gate Reflector (used to be free).