2018. 11. 9. 16:00
Using Global Interface Table(GIT) for marshalling COM interfaces
2018. 11. 9. 16:00 in link/COM
There are several things to consider when you implement codes. Recently, I implemented a program and I used GIT for marshalling COM interfaces. There is no problem when the RegisterInterfaceInGlobal function is called, but it is failed to call GetInterfaceFromGlobal. Sometimes, it causes a hang or returns errors.
I found reasons.
- The thread which calls the RegisterInterfaceInGlobal method must remain alive until the corresponding call to RevokeInterfaceFromGlobal.
- The thread which uses GIT must have a message loop to handle calls of GIT
- Single-Threaded Apartments
- The MsgWaitForMultipleObjects method is a proper choice when you have to use synchronization primitives.