[Mono-dev] COM Callable Wrapper Patch

Jon Chambers joncham at gmail.com
Fri Dec 1 16:33:35 EST 2006

    This patch adds support for COM Callable Wrappers to mono (exposing
managed objects as COM objects to unmanaged code). I started to clean up
some other cominterop work, but it just made the patch harder to read. So, I
only put new methods at the bottom of the marshal.c file with the long term
goal of all cominterop related methods located there or in another file. I
also implemented/modified alot of the marshalling code to support COM
Interop in both directions. Anyway, there are 2 changes that affect the
runtime in non-cominterop cases.
     The main change that affects the runtime outside of a COM Interop
scenario is in gc.c. Basically, any managed object can be passed to
unmanaged code. At that point, an unmanaged representation of the managed
object is created. This needs cleaned up when the object is garbage
collected. So, I register the object for finalization. In the finalizer
code, I check to see if the object has a ccw. There is a quick return if no
CCW's have been created, so while there is a function call the hash table
lookup only occurs if the program actually uses CCWs.
     I am pretty sure I need some more locking around this code for thread
safety. I'll also take a look at that for a future patch.

Please review and comment. There are tests added as well for this
functionality with some more to come. As usual, this code is contributed
under the MIT/X11 license, and I signed off in the ChangeLogs within the
runtime code.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20061201/d5326e89/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: current.diff
Type: text/x-patch
Size: 53364 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20061201/d5326e89/attachment.bin 

More information about the Mono-devel-list mailing list