Hallo,
ich versuche gerade eine C-DLL in mein Programm zu importieren.
Die Deklaration in der DLL sieht so aus:
C#-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
| extern "C" {
class __declspec(dllexport) aLibrary { public: void ExtractFiles(char* FileName, char* exportFiles[], char* exportDests[], int fileCount, bool caseSensitive, int partNo, HWND hwndEventWindow); [...] private: [...]
}; } |
und ich versuche die Methode in Delphi so zu importieren:
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18:
| type DArray = array of PAnsiChar; TExtractFiles = procedure(FileName: PAnsiChar; files, dests: DArray; filecount: Integer; caseSensitive: Bool; partNo: Integer; hwnd: THandle); stdcall;
procedure TForm1.Load; var dll: THandle; EF: TExtractFiles; a, b: DArray; begin dll := LoadLibrary(PChar(AppPath + aLibrary)); @EF := GetProcAddress(dll, 'ExtractFiles'); SetLength(a, 1); a[0] := 'test.txt'; SetLength(b, 1); b[0] := 'E:\test.txt'; EF('E:\test.dat', a, b, 1, False, 0, Handle); end; |
Es passiert jedoch rein nichts, keine neue Datei wird erstellt. Ich vermute, die DLL versteht die Parameter nicht und bekommt nur Datenmüll, weil meine Typen anders sind.
Weiß jemand woran das liegen kann?