Platform Invocation Services
The .NET Platform Invocation Services-sometimes referred to as PInvoke-allows managed code to work with functions and structures that have been exported from DLLs. In this section, we'll look at how to call DLL functions and at the attributes that are used to marshal data between a .NET application and a DLL.
Because you're not providing the source code for the DLL function to the C# compiler, you must specify to the compiler the signature of the native method as well as information about any return values and how to marshal the parameters to the DLL.
NOTE
As you know, you can create DLLs with C# and other .NET compilers. In this section, I've avoided using the term "unmanaged Win32 DLL." You should assume that any time I refer to a DLL, I'm referring to the unmanaged variety.
As you know, you can create DLLs with C# and other .NET compilers. In this section, I've avoided using the term "unmanaged Win32 DLL." You should assume that any time I refer to a DLL, I'm referring to the unmanaged variety.