Bonjour !
Voilà, j'ai avec succès compilé des dlls avec Dev-C++ que je fais tourner
sans problème avec des programmes là-encore compilé dans Dev-C++.
Mais si j'essaie de lancer mes dlls depuis une application créée avec C++ Builder, ca plante : j'ai une "access violation in machin.dll".

Voici une partie du code de la DLL :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
 
 
extern "C" __declspec(dllexport) __stdcall void DLLCoocsMain(charg1*, long, long, long, long, long,
                                                   std::string, std::string, std::string);
 
//BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
int WINAPI DllEntryPoint (HINSTANCE hInst,  unsigned long reason, void * lpReserved)
{
 return TRUE;
}
 
extern "C" __declspec(dllexport) __stdcall  void DLLCoocsMain(charg1* PtrLex3, long FP, long FM, long SM, long FenMot, long ICtx,
                                                   std::string DelimsFenMots, std::string DelimsPhrase, std::string DelimsParag)
{....
Et voici l'appel depuis le programme :
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
 
 typedef void (__stdcall *DLLFUNC_COOCS)(charg1*, long, long, long, long, long, std::string, std::string, std::string);
 
 HINSTANCE hinstDLL;
 DLLFUNC_COOCS ImpFuncDLL;
 
  if ((hinstDLL=LoadLibrary ("coocs.dll")))
  {
   ImpFuncDLL=(DLLFUNC_COOCS)GetProcAddress(hinstDLL, "DLLCoocsMain");
   if (ImpFuncDLL)
   ImpFuncDLL(PtrClcharg, 28, 5, 5, 1, 1, "", ".?!", "");
   if (ImpFuncDLL)MessageBox(NULL, "Validé", "Salut", MB_ICONERROR);
   else
	{
	return false;
	}
   FreeLibrary (hinstDLL);
  }
Quelqu'un a une idée ? Ou mieux, un exemple de code ?
Merci !