Voilà, g une fonction créé en C++ avec VC++. Elle marche très bien si elle est mis dans un EXE, mais dès k'elle est ds une DLL, ca marche plus !!
Avec VB, il me met "Bad calling DLL convention"
Aidez moi, je sais vraiment pas koi faire...
Ah oui, j allais oublier, voici la source :
extern "C" __declspec(dllexport) char *Cryptage(const char * Entree, long Cle, long Operation)
{
//---------------------------------------------
// Déclaration des variables
//---------------------------------------------
char *Sortie1 = "";
double Algo_tmp = 0;
long Algo = 0;
int tmp = 0;
int i = 0;
Cle = Cle - 1;
if (Operation == 0) {
for (i = 0; i < strlen(Entree); i++) { //Boucle de Cryptage
Cle = Cle + 1;
Algo_tmp = cos(pow(Cle, 5)) * 10;
Algo = (int)(Algo_tmp < 0 ? Algo_tmp - 0.5 : Algo_tmp + 0.5); //on arrondi
tmp = Entree[i];
tmp += Algo;
Sortie1[i] = tmp;
i++;
}
return Sortie1;
}
if (Operation == 1) {
for (int i = 0; i < strlen(Entree); i++) { //Boucle de Decryptage
Cle = Cle + 1;
Algo_tmp = cos(pow(Cle, 5)) * 10;
Algo = (int)(Algo_tmp < 0 ? Algo_tmp - 0.5 : Algo_tmp + 0.5); //On arrondi le nombre
tmp = Entree[i];
tmp -= Algo;
Sortie1[i] = tmp;
}
return Sortie1;
}
}
\* -- Seb -- */