Bonjour tout le monde, mon appli fonctionne en _MBCS comme en _UNICODE.
J'ai cr�� une DLL qui stocke dans une 'multimap' des objets contenant des variable et nottament les ressources de la DLL au format "GIF".
J'acc�de � un objet de cette 'multimap' dans mon programme au moyen d'une fonction comprise dans la DLL.
La fonction dans la DLL ressemble � ce bout de code r�sum� :
Quand je l'utilise dans le programme au format _MBCS tout se passe merveilleusement bien. Lorsque j'utilise le programme en _UNICODE( je n'oublie pas de faire une recompilation de la dll en _UNICODE) J'ai un message d'erreur au moment du "return &it->second;" qui dit :
Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
11
12 DLLDEC CImageProduit* GetImgProd(_string DescriptorID,CImageProduit::eProdImgType eType) { multimap <_string, CImageProduit>::iterator it; it = m_mapImgList.find(DescriptorID); int iType = (int)eType; for(int i=0;i<iType;i++) it++; return &it->second; };
"Windows has triggered a breakpoint in Program.exe.
This may be due to a corruption of the heap, which indicates a bug in Program.exe or any of the DLLs it has loaded.".
Je ne sais pas si �a peut aider, mais je vous montre l'exportation de la function de la DLL. Cela vient d'un tuto de Farscape
Info suppl�mentaire : la DLL n'est pas pas une extension des MFC. Elle est li�e dynamiquement et le programme est une appli MFC.
Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 // Functions that can be exported #ifdef _WINDLL #define DLLDEC __declspec(dllexport) #else #define DLLDEC __declspec(dllimport) #endif #ifdef __cplusplus extern "C" { #endif //=================================================================================== // Use that function to return a pointer to a ImageProduit object //=================================================================================== // The first argument is a DescriptorID'string that is coming from the Product's // Database. The second is the type of image. It can be an Image, a Symbol // Image or a Localized Symbol Image. The function returns a CImageProduit object pointer // given all parameters for the selected image. DLLDEC CImageProduit* GetImgProd(_string DescriptorID,CImgTAProd::eProdImgType eType); //=================================================================================== #ifdef __cplusplus } #endif
Je ne sais pas trop quoi faire... si quelqu'un aurait une id�e, elle serait la bienvenue.
Je vous remercie d'avance.
Partager