Click here to Skip to main content
16,004,882 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalnamespaces Pin
scratchmonkey17-May-05 4:24
scratchmonkey17-May-05 4:24 
GeneralRe: namespaces Pin
Trollslayer17-May-05 4:47
mentorTrollslayer17-May-05 4:47 
GeneralRe: namespaces Pin
scratchmonkey17-May-05 5:16
scratchmonkey17-May-05 5:16 
GeneralRe: namespaces Pin
Anthony_Yio17-May-05 17:27
Anthony_Yio17-May-05 17:27 
GeneralProblem in DLL Pin
rajas17-May-05 4:16
rajas17-May-05 4:16 
GeneralRe: Problem in DLL Pin
Blake Miller17-May-05 4:55
Blake Miller17-May-05 4:55 
GeneralRe: Problem in DLL Pin
rajas17-May-05 5:13
rajas17-May-05 5:13 
GeneralRe: Problem in DLL Pin
Blake Miller17-May-05 5:40
Blake Miller17-May-05 5:40 
Does the EXE loading the DLL initialize COM ?

If so, does the COM initialization in the EXE occur prior to the initialization in the DLL ?

You might find that your DLL initialization will need to be deferred to an exported 'initialization' call, rather than in the InitInstance, which is basically the same as DLL_PROCESS_ATTACH. As a result of deferral, some class instances dependent upon COM, if they do 'interesting' operations in their constructors, might not be able to remain global, they might have to be created dynamically. The pointers to instances of the classes could be global, but not the instances of the classes themselves.

Basically, you might need to rework in this order, then:
EXE loads DLL (statically, I am presuming, since DLL is linked to EXE)
EXE initializes COM
EXE calls 'init' function exported from DLL
DLL 'init' function 'creates' global objects
...EXE does other work...
EXE calls shutdown function in DLL
DLL frees global objects
EXE uninitializes COM
Windows unloads DLL from EXE address space
EXE exits

You can also get into trouble with COM when creating instances and references to objects that MIGHT not be activated or deleted by the same thread in the EXE as those objects were created.

GeneralRe: Problem in DLL Pin
rajas17-May-05 6:06
rajas17-May-05 6:06 
GeneralRe: Problem in DLL Pin
rajas17-May-05 10:04
rajas17-May-05 10:04 
GeneralThread priority management Pin
ilgale17-May-05 4:04
ilgale17-May-05 4:04 
GeneralRe: Thread priority management Pin
Bob Stanneveld17-May-05 4:59
Bob Stanneveld17-May-05 4:59 
GeneralRe: Thread priority management Pin
ilgale17-May-05 5:16
ilgale17-May-05 5:16 
GeneralRe: Thread priority management Pin
Bob Stanneveld17-May-05 22:24
Bob Stanneveld17-May-05 22:24 
GeneralRe: Thread priority management Pin
ilgale17-May-05 23:04
ilgale17-May-05 23:04 
GeneralRe: Thread priority management Pin
Bob Stanneveld18-May-05 2:15
Bob Stanneveld18-May-05 2:15 
GeneralHere's a good one! .cram files! Pin
steve333317-May-05 4:02
steve333317-May-05 4:02 
QuestionHow to load bitmap, which is located in Access, on a FormView (MFC) Pin
chinook7517-May-05 3:43
chinook7517-May-05 3:43 
GeneralGetting command line parameters of a running process Pin
rocky_pulley17-May-05 3:36
rocky_pulley17-May-05 3:36 
GeneralRe: Getting command line parameters of a running process Pin
«_Superman_»17-May-05 4:26
professional«_Superman_»17-May-05 4:26 
GeneralRe: Getting command line parameters of a running process Pin
rocky_pulley17-May-05 4:41
rocky_pulley17-May-05 4:41 
GeneralRe: Getting command line parameters of a running process Pin
David Crow17-May-05 5:53
David Crow17-May-05 5:53 
GeneralRe: Getting command line parameters of a running process Pin
David Crow17-May-05 4:43
David Crow17-May-05 4:43 
GeneralAllocating very large memory Pin
Orkun GEDiK17-May-05 3:35
Orkun GEDiK17-May-05 3:35 
GeneralRe: Allocating very large memory Pin
James R. Twine17-May-05 3:41
James R. Twine17-May-05 3:41 

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.