Calling Managed code from Native Code.

In today’s Windows CE 5.0 online chat (which was pretty busy from start to finish) one of the questions that came up was whether Windows CE supports the ability to call managed code from native code (kinda like a reverse P/Invoke).

There is limited Com Callable Wrappers (CCW) support in CF 2.0.  However, there is no registration or activation support in CF 2.0.

What this means is that a managed application can pass managed interfaces to native code, and the native code can treat these interfaces as COM Interface Pointers to make calls back into the managed code.  Additionally, CF 2.0 supports passing managed delegates to native code as function pointers which native code can used to call back into managed code.  However, there is no support for a purely native app to call into managed code.  All pointers need to be passed from managed code to native code before any calls can be made back into managed code.

More information about Com Callable Wrappers can be found on MSDN

So, I have a question for you… if you’re writing applications for Windows CE Embedded devices, or Pocket PC/Smartphone devices, are you using Win32/MFC/ATL, or C#/VB – and why did you choose to use that programming model ?

– Mike