Delphi-DLL in VS6 -> Fehlermeldung beim Funktionsaufruf
-
Ich hab ne DLL in Delphi, welche eine normale Procedure enthält. Zum testen gibt die nur den ersten Parameter in einer Messagebox aus.
Wenn ich die Prozedur in Delphi aufrufe, Klappt alles perfekt.
Wenn ich sie aber in meinem C-Programm aufrufen will, krieg ich folgende Fehlermeldung:--------------------------- Microsoft Visual C++ Debug Library --------------------------- Debug Error! Program: ...ocuments\Active Projects\NAMP\TVInterface\TEMP\Debug\TEMP.exe Module: File: i386\chkesp.c Line: 42 The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention. (Press Retry to debug the application) --------------------------- Abbrechen Wiederholen Ignorieren ---------------------------
Hier der Code der Prozedur in der dll
procedure GetClassProperties(ClassName: PChar; PropertyCount: PInteger; DeviceCount: PInteger; aProperties: Pointer); stdcall; begin ShowMessage(ClassName); end;
Und hier wie ich die Prozedur aus der dll aufrufen will
typedef void (*tGetWMIClasses) (char* ClassName, int* PropertyCount, int* DeviceCount, void* Properties); int main(int argc, char* argv[]) { HMODULE DLL; tGetWMIClasses Proc; int PropertyCount; int DeviceCount; char*** Properties; printf("Load Library...\n"); DLL = LoadLibrary("F:\\Chimaira\\My Documents\\Active Projects\\NAMP\\TVInterface\\WMIDLL\\WMIClass.dll"); Proc = (tGetWMIClasses)GetProcAddress(DLL, "GetClassProperties"); char s[17] = "Win32_Processor\0"; (*Proc)(s, &PropertyCount, &DeviceCount, (void*)(&Properties)); return 0; }
Ich krieg die Messagebox mit dem richtigen Parameter und dann die oben genannte Fehlermeldung.
Kann mir jemand erklären, warum? Wo liegt mein Fehler?