列集: 為了將一個(gè)接口指針從一個(gè)線(xiàn)程傳遞到同一進(jìn)程內(nèi)的另一個(gè)線(xiàn)程中。
用到的兩個(gè)函數(shù):CoMarshalInterface和CoUnmarshalInterface.
CoMarshalInterface
Writes into a stream the data required to initialize a proxy object in some client process. The COM library in the client process calls the CoUnmarshalInterface function to extract the data and initialize the proxy. Before calling CoUnmarshalInterface, seek back to the original position in the stream. CoMarshalInterface can marshal only interfaces derived from IUnknown.
CoUnmarshalInterface
Initializes a newly created proxy using data written into the stream by a previous call to the CoMarshalInterface function, and returns an interface pointer to that proxy.
列集可以通過(guò)函數(shù)CoMarshalInterface函數(shù)來(lái)完成,當(dāng)調(diào)用CoMarshalInterface第一次為對(duì)象進(jìn)行列集時(shí)會(huì)為對(duì)象建立一個(gè)存根管理器,而以后對(duì)同一個(gè)對(duì)象的其他接口列集時(shí),就不會(huì)再建一個(gè)存根管理器.
進(jìn)程具有一個(gè)或者多個(gè)套間,任何一個(gè)線(xiàn)程在某一時(shí)刻只能在一個(gè)套間種運(yùn)行。
每個(gè)COM對(duì)象只能屬于一個(gè)套間。為了使每個(gè)套間之間能夠進(jìn)行通信。
COM支持跨套間邊界的對(duì)象引用列集機(jī)制。