O'Reilly logo

Special Edition Using C# by NIIT

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The PInvoke Utility

Apart from COM interoperability, .NET applications might also have to access some of the functions existing in the Win32 API or in other unmanaged DLLs. An unmanaged DLL is one created using unmanaged code. For example, a DLL created using Visual Basic 6 is an unmanaged DLL. Functions that exist in unmanaged DLLs are unmanaged functions. In order to access these unmanaged functions, the .NET Framework provides the Platform Invocation Services, also referred to as PInvoke.

PInvoke handles the tasks of finding and invoking the correct function from the DLL. It also handles the marshalling between the managed .NET application and the unmanaged DLL function.

Unsafe and Unmanaged Code

To understand the use of PInvoke, take a ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required