Search code examples
c#pinvoke.net-assembly

How can I check if a DLL uses P/Invoke (DllImport)?


Given a DLL, how can I make sure it does (or does not) use P/Invoke, with a command line tool?


Solution

  • ildasm /text file.dll | findstr pinvokeimpl
    

    If the result is empty, pinvoke is not being used by the dll (or exe), otherwise it is.

    N.B. ildasm should come installed with Visual Studio, and is easiest to call when using the Visual Studio Developer Command Prompt.