Hallo,
Ich habe folgendes Problem: Ich habe eine
DLL-Datei, welche in C++ geschrieben ist und folgende Funktion enthält
Code:
int
WINAPI getmove(int b[8][8],int color, double maxtime, char str[255], int *playnow, int info, int unused, struct CBmove *move)
Hier noch die dafür benötigen Strukturen:
Code:
struct coor
{
int x;
int y;
};
struct CBmove
{
int jumps;
int newpiece;
int oldpiece;
struct coor from,to;
struct coor path[12];
struct coor del[12];
int delpiece[12];
} GCBmove;
Und hier mein Versuch, das ganze zu importieren und zu übersetzen:
Delphi-Quellcode:
type
TPoint = record
x: Integer;
y: Integer;
end;
type
PMove = ^TMove;
TMove = record
nJumps: Integer;
nNewPiece: Integer;
nOldPiece: Integer;
pfrom, pto: TPoint;
pPath: array [0 .. 12] of TPoint;
pdel: array [0 .. 12] of TPoint;
nDelPiece: array [0 .. 12] of Integer;
end;
type
TBoard = array [0 .. 8, 0 .. 8] of Integer;
procedure TForm1.Button1Click(Sender: TObject);
var
Dllh: THandle;
GetMove: function(Board: TBoard; color: Integer; MaxTime: DOUBLE;
str: array of Char; var playnow: Integer; info: Integer; unused: Integer;
Move: PMove): Integer; stdcall;
begin
Dllh := LoadLibrary(PChar(ExtractFilePath(Application.ExeName)
+ 'cakeM32.dll'));
@GetMove := GetProcAddress(Dllh, 'getmove');
Ging natürlich vollkommen nach hinten los, nach einem Aufruf gibts direkt ne schöne Fehlermeldung und da ich nicht glaube, dass die
DLL fehlerhaft ist, denke ich mal, dass mir irgendwo beim deklarieren der Variablen ein Übersetzungsfehler unterlaufen muss sein.
MfG,
STaRDoGGCHaMP