Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

How to force all calls from unmanaged host app into managed plugin to MTA

$
0
0

Hi

I am writing a managed plugin for an 3rd party unmanaged non-COM host application. But because all the interfaces that are used to communicate between host and plugin are COM compatible, I use COM-interop to help me with the interop between unmanaged and managed. The entry point of the plugin is an exported function that is called by the host (DllExportAttribute). But the host app is not COM, it does not call CoInitialize or CoCreateInstance or any of that. So it's not a plain vanilla COM-interop scenario!

I am making good progress in implementing this plugin - however I ran into a problem that I think may have to do with the type of apartment the CLR has assigned to the calling unmanaged threads (I know for sure that there are more than one threads used in the unmanaged host to call into the plugin). I want all calls from the unmanaged host to run in the MTA (free threading) so I don't have the overhead of sync/pumping of the STA. 

My question is: how can I make the CLR assign MTA to incoming threads, instead of STA?

Thanx, Marc


Marc Jacobi


Viewing all articles
Browse latest Browse all 1710

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>