O'Reilly logo

Microsoft® .NET Compact Framework (Core Reference) by Mark Sutton, Rory MacLoed, Robert Burbidge, Stephen Wheelwright, Andy Wigley

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

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 ...

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