When to use P/Invoke vs. Interop

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi,
I was trying to learn more about when to use P/Invoke vs. Interop. The
book I am reading says use P/Invoke when I am calling unmanaged Windows
API function. Is P/Invoke only used with unmanaged API functions, or
could I use Interop instead? To my understanding I could use Interop
all the time but the advantage of P/Invoke is for performance reasons
since it does not do type checks, etc. Am I correct?

Thanks
Ross

.



Relevant Pages

  • Re: C++ Interop and P/Invoke in C++
    ... P/Invoke is managed code calling an unmanaged Dll. ... The term "Interop" is used loosely, so it's best to explain exactly what ...
    (microsoft.public.dotnet.framework.interop)
  • Re: C++ Interop and P/Invoke in C++
    ... C language Win32 dll. ... P/Invoke is managed code calling an unmanaged Dll. ... The term "Interop" is used loosely, so it's best to explain exactly what ...
    (microsoft.public.dotnet.framework.interop)
  • Re: NEWBIE: use COM Interop or P/Invoke?
    ... If I had the option of interop using COM or P/Invoke I would ... Writing a DLL is simple, if you keep your interop data types simple, P/I is ... And eventually my code will run as a Windows Service. ...
    (microsoft.public.dotnet.framework.interop)
  • Re: When to use P/Invoke vs. Interop
    ... I though tha P/Invoke / Interop was just different name for the same things. ... If you're in a war, instead of throwing a hand grenade at the enemy, throw ... > API function. ...
    (microsoft.public.dotnet.framework)
  • Re: Managed dll and native c dll
    ... "Raj" wrote in message ... P/Invoke is lot clear - you have to do work to make it work. ... this C++ interop because I am working on a performance sensitive project. ... C++ has its own marshal class which is very helpful for converting e.g. ...
    (microsoft.public.dotnet.framework.interop)