Link to home
Start Free TrialLog in
Avatar of rachels
rachels

asked on

AFX_MODULE_STATE with USRDLL vs AFXDLLs

Will someone please explain how "Module state" is maintained
differently when using a USRDLL vs an AFXDLL? For example,
for a USRDLL, when an CWinApp's InitInstance is called,
the runtime automatically switches the state, but when I
use the shared MFC DLL, I must call AFX_MAINTAIN_STATE(...)
at the beginning of all exported functions.

I don't really understand what is going on with the state, especially when multithreading comes into the picture.
For example, if in an USRDLL I call AfxBeginThread and I'm
linking to shared MFC DLL, how does module state come into play?
ASKER CERTIFIED SOLUTION
Avatar of doronh
doronh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of codediscuss
codediscuss

but WHY the state data of each module is not application-wide?