Using P/Invoke
P/Invoke functions and attributes are found in the System.Runtime.InteropServices namespace. The .NET Compact Framework supports a useful subset of P/Invoke functions from the full .NET Framework. Most simple unmanaged code functions can be called without difficulty from managed code. Unmanaged code functions with more complex parameter passing requirements will need some additional support in the managed code caller.
Declaring an Unmanaged Code Function
To call a function in unmanaged code using P/Invoke, that function must be exported from a DLL. An exported function is one that can be called across an EXE/DLL or DLL/DLL boundary.
From the .NET point of view, unmanaged code functions are static. They do not operate on instances of ...
Get Microsoft® .NET Compact Framework (Core Reference) now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.