Salut
mon dll que je veux testé est :
Header
Code cpp : 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
28
29
 
/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 440
#endif
 
#include "stdafx.h"
#include "rpc.h"
#include "rpcndr.h"
#include <string>
 
using namespace std;
 
#ifndef __DLLTEST_h__
#define __DLLTEST_h__
 
#define EXPORT __declspec(dllexport);
 
#ifdef __cplusplus
extern "C"{
#endif 
 
EXPORT string __stdcall GetTypeConnexion(string PS_szTypeConnexion, string PS_szLibelleErreur);
 
#ifdef __cplusplus
}
#endif
 
#endif
.cpp
Code cpp : 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
 
#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "DLLTEST.h"
#include <fstream>
#include <string>
#include "DLLTEST.c"
 
// Taille maximale de l'url
#define TAILLE_MAX 1000 
using namespace std;
 
char    CODEERREUR;
string  LIBELLEERREUR;
char    MODEDECONNEXION;
string GetURL() {
	ifstream fichierConfig("DLLTEST.config" );
	string pURL = "";
	if (fichierConfig) {
		getline(fichierConfig,pURL);
		if (pURL == "") {
			CODEERREUR = '9';
			LIBELLEERREUR = "Fichier DLLTEST.config vide";
			MODEDECONNEXION = 'S';
			return pURL;
		}
 
    } else {
 
		// Si fichier introuvable
		CODEERREUR = '9';
		LIBELLEERREUR = "Fichier DLLTEST.config non trouvé";
		MODEDECONNEXION = 'S';
		return pURL;
	}
 
	return pURL;
}
string  __stdcall GetTypeConnexion(string PS_szTypeConnexion, string PS_szLibelleErreur) {
 
	// Chargement du module DLL
	HINSTANCE  hDLL = LoadLibrary("uneautredlldotnetacharger.dll");
 
	string modeCnx;
	string codeErr;
 
	if (hDLL != NULL) {
 
 
		typedef char *DLL_Function_getTypeConnexion (string pURL);
 
		// instantiation de la fonction getTypeConnexion
		DLL_Function_getTypeConnexion *fn_getTypeConnexion;
 
		// Chargement en mémoire
		fn_getTypeConnexion = (DLL_Function_getTypeConnexion*)GetProcAddress(hDLL,"getTypeConnexion");
 
		// Lecture de l'url sur DLLTEST.config
		string pURL = GetURL();
 
		if (pURL != "") {
			// Appel de la méthode getTypeConnexion()
			MODEDECONNEXION = *fn_getTypeConnexion(pURL);
 
		} else {
			MODEDECONNEXION = 'S';
		}
		modeCnx = MODEDECONNEXION;
		codeErr = CODEERREUR;
		FreeLibrary(hDLL);
	}
	return string(modeCnx) + string(codeErr) + LIBELLEERREUR;
}

J'ai ajouté au projet mon fichier .def.
Je veux ajouter un programme pour testé cette dll ou bien ajouter des message pour testé que l'appel du dll dotnet ça se passe comme il le faut.
Merci

A vs