Hallo,
ich habe ein merkwürdiges Problem:
Ich lade eine Funktion dynamisch aus einer DLL (GetValue).
In TMainForm wird die Funktion korekt aufgerufen mit Index von 0 bis 13668.
Beim debuggen der DLL kommt aber als Übergabeparameter "Index" immer
andere viel zu hohe Zahlen an die dann auch pro Aufruf um 1 inkrementiert werden.
z.B. 13348608, 13348609, 13348610...
Das Problem trat plötzlich auf und ohne dass
ich etwas an den beteiligten Funktionen geändert hätte.
Aufruf im Hauptprogramm:
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
| function TMainForm.GetValue(index: integer): string; var DllFx: TInfoIndexFunction; const FxName = 'GetValue'; begin if PlugHandle <> 0 then begin @DllFx := GetProcAddress(PlugHandle, PChar(FxName)); if @DllFx <> nil then Result := string(DllFx(index)) else MsgNoFx(FxName); end else MsgNoLib(FxName); end; |
DLL Funktion
Delphi-Quelltext
1: 2: 3: 4: 5: 6:
| function GetValue(index: integer): PChar; begin if ((index < StrBuf.Count) and (index >= 0)) then Result := PChar(StrBuf[index]) else Result := PChar('ERROR'); end; |