I finished working on my Checkers game engine and about to make it CheckerBoard (http://www.fierz.ch/cbdeveloper.php) compatible, and it states that.
CheckerBoard expects your engine to be compiled as a dll and to be in the working directory of checkerboard.exe - or in the path. An engine must support 2 required functions. ..., you must provide 2 more functions for multi-version support. The calling convention for all functions is __stdcall().
Required Functions
The current CheckerBoard API (version 2) requires the following 2 functions:
int WINAPI getmove(int board[8][8], int color, double maxtime, char str[1024], int *playnow, int info, int moreinfo, struct CBmove *move); int WINAPI enginecommand(char command[256], char reply[1024]);
my engine includes the two above functions, i've got everything setup (the code) but i'm having troubles compiling it as dll, heres what i tried (using gcc)
gcc -c engine.c
gcc -shared -o engine.dll engine.o
it creates the dll as expected but the dll doesn't export any of the functions (as expected).
I used the Dependency walker program to scan the engine.dll file, and it shows that the dll exports the functions
- _getmove@28
- _enginecommand@20
i scanned one of the engines in the CheckerBoard directory and i found that they export the following functions:
- getmove
- enginecommand
i cant figure out why the dll i created exports differently, maybe its got something to do with the WINAPI ?.
Any ideas ?
here's what it looks like
#define EXPORT __declspec(dllexport)
EXPORT int WINAPI getmove(int b[8][8], int color, double time, char str[1024], int *playnow, int info, int unused, struct CBmove *cbmove){
// ....
return 0;
}
EXPORT int WINAPI enginecommand (char str[256], char reply[1024]){
// ...
return 0;
}
i need both functions to be exported through the dll.