Click here to Skip to main content
15,844,477 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm new to platform invoke for managed <-> unmanaged code interop.

After reading some documents, I found P/Invoke is ONLY applied when managed code to call unmanaged(native) code. Is that right?

How about unmanaged code calls managed dll?
I find an interesting approach called "exposing managed component to COM" which can be applied when unmanaged code calls managed component(so it is not part of P/Invoke?)
Posted

1 solution

Platform Invoke is used to call Win32 functions from managed code.
See PInvoke.net/[^]

For calling managed code from unmanaged code one approach is to use COM Interop where COM interfaces are exported from the managed code.
See COM Interop Part 2[^]

So yes, you are right in your assumptions.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900