Réponse acceptée !
Regarde le bouquin de richter s'il dit quelque chose la dessus :
[ Lien ]
[ Lien ]apparemnt il vaut mieux éviter de faire des appels à des fonctions situées dans d'autre dll dans dllmain (en particulier faire des appels aux MFC) car toutes les dll n'ont pas forcément été chargée lors l'appel à ton dllmain.
page
"You must remember that DLLs use
DllMain functions to initialize themselves. When your
DllMain executes, other DLLs in the same address space probably haven't executed their
DllMain functions yet. This means that they have not initialized, so you should avoid calling functions imported from other DLLs. In addition, you should avoid calls to
LoadLibrary(
Ex) and
FreeLibrary from inside
DllMain because these functions can create dependency loops.
The Platform SDK documentation states that your DllMain should perform only simple initialization such as setting up thread local storage (discussed in Chapter 21), creating kernel objects, and opening files. You must also avoid calls to User, Shell, ODBC, COM, RPC, and socket functions (or functions that call these functions) because their DLLs might not have initialized yet or the functions might call LoadLibrary(Ex) internally, again creating a dependency loop.
Also be aware that the same problems exist if you create global or static C++ objects because the constructor or destructor for these objects is called at the same time as your DllMain function".