Calling the COM-API directly via P/Invoke

S

Sebastian Zenker

Why isn't it possible to call the COM-API (CoInitialize,
CoCreateInstance, etc.) directly via P/Invoke instead of writing a
unmanaged+managed wrapper or using a library like CFCOM?

Which DLL exports the COM functions?

Sorry I'm a newbe with COM Interop.
 
P

Peter Foot [MVP]

CoCreateInstance will only create you an instance of a COM interface, you
can call this function from managed code, the problem then is that there is
no way to directly invoke functions on the object, which is why its
necessary to provide an interop layer in native code to expose standard C
functions to call these COM methods.
..NETCF v2.0 will support calling COM code directly from your managed code by
producing a runtime callable wrapper around a COM interface, as you can do
with the desktop .NET v1.x framework.

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Do have an opinion on the effectiveness of Microsoft Windows Mobile and
Embedded newsgroups? Let us know!
https://www.windowsembeddedeval.com/community/newsgroups
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top