Salut
Comment declarer et utiliser une dll Delphi
pour une procedure Delphi de ce type:
Procedure Proc1(abc :PChar); Stdcall;
et une fonction de ce type:
Function Fonc(abc, def :PChar): PChar; Stdcall;
Merci
Version imprimable
Salut
Comment declarer et utiliser une dll Delphi
pour une procedure Delphi de ce type:
Procedure Proc1(abc :PChar); Stdcall;
et une fonction de ce type:
Function Fonc(abc, def :PChar): PChar; Stdcall;
Merci
Salut tu peux utiliser l'exemple suivant
Avec mes salutationsCode:
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 #include <condefs.h> #include <iostream> #include <windows.h> #include <stdlib.h> #include <stdexcept> //--------------------------------------------------------------------------- #pragma argsused using namespace std; HINSTANCE hDll = 0; // declaration des types importés depuis ta dll typedef void(__stdcall *TProc1) (char* value); typedef char*(__stdcall *TFonc) (char* abc,char* def); TProc1 Proc1=NULL; //assignation a 0 des variables TFonc Fonc =NULL; void DLLFree() { FreeLibrary(hDll); } void DLLInit() { hDll = LoadLibrary("delphi.dll"); Proc1 = (TProc1 )GetProcAddress(hDll, "Proc1"); Fonc = (TFonc)GetProcAddress(hDll, "Fonc"); } int main(int argc, char* argv[]) { DLLInit(); char i[1]; try { Proc1(Fonc("Test de ma"," Dll")); } catch (const exception& e) { cout <<" error When loading DLL or Function"; } DLLFree(); cout <<"Please Return Key "<<endl; cin.getline(i,1); return 0; }
:lol: :lol:
Merci :D