Click here to Skip to main content
15,916,293 members
Home / Discussions / COM
   

COM

 
QuestionEthernet Programming Pin
Muhammad Azeem Azam22-Aug-06 23:01
Muhammad Azeem Azam22-Aug-06 23:01 
AnswerRe: Ethernet Programming Pin
Mike Dimmick23-Aug-06 0:22
Mike Dimmick23-Aug-06 0:22 
QuestionNamespace in IDL Pin
Andre xxxxxxx22-Aug-06 11:56
Andre xxxxxxx22-Aug-06 11:56 
AnswerRe: Namespace in IDL Pin
Steve S22-Aug-06 21:56
Steve S22-Aug-06 21:56 
GeneralRe: Namespace in IDL Pin
Andre xxxxxxx23-Aug-06 2:30
Andre xxxxxxx23-Aug-06 2:30 
GeneralRe: Namespace in IDL Pin
Steve S23-Aug-06 3:07
Steve S23-Aug-06 3:07 
QuestionCreate a Thread in COM dll but thread "HANG the whole COM DLL"~ Pin
rockryan21-Aug-06 8:19
rockryan21-Aug-06 8:19 
AnswerRe: Create a Thread in COM dll but thread "HANG the whole COM DLL"~ Pin
Mike Dimmick22-Aug-06 2:34
Mike Dimmick22-Aug-06 2:34 
You can create a thread in DllMain, but you can't wait on it. It will immediately cause the OS to try to re-enter DllMain to give the DLL_THREAD_ATTACH notification, but the new thread will wait there because it needs to acquire the Loader Lock. Your original thread will already have the Loader Lock, and will not release it until it returns from DllMain. If the first thread now tries to wait for some other event to occur that's signalled by the second thread, you have a deadlock.

Basically, don't do any work at all in DllMain. Instead, do lazy initialisation, when actually needed. In a COM object you might do this in the object's constructor, or otherwise in response to CoCreateInstance. For example, ATL offers the FinalConstruct method to allow you to do extra initialisation after the constructor has run but before CoCreateInstance returns.

Finally recall that interface pointers are apartment-relative. If calling back into a client from a worker thread, you need to make sure the call is marshalled correctly. See the Global Interface Table for an idea of how to do this.

Stability. What an interesting concept. -- Chris Maunder

GeneralRe: Create a Thread in COM dll but thread "HANG the whole COM DLL"~ Pin
rockryan27-Aug-06 3:05
rockryan27-Aug-06 3:05 
Question....> Graduation Project <..... Pin
amalemam19-Aug-06 13:23
amalemam19-Aug-06 13:23 
QuestionDCOM Memory not being Released Pin
cyoung3518-Aug-06 8:35
cyoung3518-Aug-06 8:35 
QuestionActivex control not able move in the form Pin
rahul_7718-Aug-06 3:33
rahul_7718-Aug-06 3:33 
QuestionHow to generate strong key name for an interop? Pin
Shilpa117-Aug-06 14:02
Shilpa117-Aug-06 14:02 
AnswerRe: How to generate strong key name for an interop? Pin
Mike Dimmick19-Aug-06 13:35
Mike Dimmick19-Aug-06 13:35 
QuestionXPCOM component registration Pin
Ayesha Farheen17-Aug-06 0:20
Ayesha Farheen17-Aug-06 0:20 
AnswerRe: XPCOM component registration Pin
User 21559717-Aug-06 21:01
User 21559717-Aug-06 21:01 
Questionwhich book is good for COM Pin
sarojkumarjena16-Aug-06 23:53
sarojkumarjena16-Aug-06 23:53 
AnswerRe: which book is good for COM Pin
Kevin McFarlane17-Aug-06 0:35
Kevin McFarlane17-Aug-06 0:35 
GeneralRe: which book is good for COM Pin
Rory Solley17-Aug-06 23:12
Rory Solley17-Aug-06 23:12 
AnswerRe: which book is good for COM Pin
odiesback24-Aug-06 11:01
odiesback24-Aug-06 11:01 
QuestionBasics About COM..... Pin
Prabs frm PGP16-Aug-06 19:04
Prabs frm PGP16-Aug-06 19:04 
AnswerRe: Basics About COM..... Pin
With_problem16-Aug-06 19:39
With_problem16-Aug-06 19:39 
GeneralRe: Basics About COM..... Pin
Prabs frm PGP16-Aug-06 21:10
Prabs frm PGP16-Aug-06 21:10 
QuestionActive x fire events how?? [modified] Pin
With_problem16-Aug-06 18:32
With_problem16-Aug-06 18:32 
AnswerRe: Active x fire events how?? Pin
kumarprabhakar7422-Aug-06 19:37
kumarprabhakar7422-Aug-06 19:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.