In Brief

  • There are a variety of situations where it is necessary for managed code to call into native code, such as for calling the Windows CE API.

  • While managed binaries are portable to all of the CPU types supported by the .NET Compact Framework, developers must be careful to use native binaries compatible with the hardware they are running on.

  • DLLs written in C++ sometimes use name mangling on the function names they expose, making it harder to call into such DLLs from managed code.

  • To call a native function from managed code, you first declare the native function in the class from which it will be called. Then the native function is treated as one of the class' methods.

  • Managed code throws exceptions if it cannot find the native DLL to call into, ...

Get Microsoft® .NET Compact Framework Kick Start 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.