Help compiling Scorpio Bitbases calls with MINGW 4.8.1

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
Kempelen
Posts: 620
Joined: Fri Feb 08, 2008 10:44 am
Location: Madrid - Spain

Help compiling Scorpio Bitbases calls with MINGW 4.8.1

Post by Kempelen »

Hello,

These past days I upgraded my MINGW compilation from 4.7.0 to 4.8.1-4. Before upgrading, I was able to compile my engine without warnings and errors. Now, after running the install program and compiling again thought Codeblocks, I get the following message compiling a section of EGBB Scorpio bitbases code:

Code: Select all

typedef int     (CDECL * PPROBE_EGBB) (int player, int w_king, int b_king,
                                       int piece1, int square1, int piece2,
                                       int square2, int piece3, int square3);

ERROR I get:
E:\Rodin\egbb.c|42|error: expected ')' before '*' token
I have not modify any of the compilation option, nor code also. My first suspicius was CDECL have changed (point the mouse over it I see is declared as _cdecl), so I modified the line with this:

Code: Select all

typedef int     (__cdecl * PPROBE_EGBB) (int player, int w_king, int b_king,
                                       int piece1, int square1, int piece2,
                                       int square2, int piece3, int square3);

ERROR I get:
C:\Users\Tibor\AppData\Local\Temp\ccMPDEjR.s|886|Error: expecting string instruction after `rep'
As I understand, there should not be any need to modify nothing. If it was compiling OK with 4.7.0, so should be with 4.8.1. Have anybody experienced these before? Any idea how can I fix this problem?.

Thank you very much in advance.
Fermín
Fermin Serrano
Author of 'Rodin' engine
http://sites.google.com/site/clonfsp/
Daniel Shawul
Posts: 4186
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Help compiling Scorpio Bitbases calls with MINGW 4.8.1

Post by Daniel Shawul »

Hi Fermin
Maybe this would help
http://mingw.5.n7.nabble.com/Assembler- ... 32308.html
"mingw-get upgrade binutils" fixed the problem.
While you are at it, please try the 6-men egbb probing. Use the following function for probing which is named as probe_egbb_xmen inside the dlls.

Code: Select all

typedef int (CDECL *PPROBE_EGBB) (int player, int* piece,int* square);
You have to terminate the piece array with a 0 so that it would know the number of pieces. You have to download new egbbs from http://shawul.olympuschess.com/egbb/
It has the new egbbdlls so you can directly use it. Also it is compatible with older probe code so it is ok to replace the old one with this. I will put some 6 men if you need them for testing.
My new probe code for scorpio is as follows

Code: Select all

#include "scorpio.h"

enum egbb_colors {
	_WHITE,_BLACK
};
enum egbb_occupancy {
	_EMPTY,_WKING,_WQUEEN,_WROOK,_WBISHOP,_WKNIGHT,_WPAWN,
    _BKING,_BQUEEN,_BROOK,_BBISHOP,_BKNIGHT,_BPAWN
};
enum egbb_load_types {
	LOAD_NONE,LOAD_4MEN,SMART_LOAD,LOAD_5MEN
};

#define _NOTFOUND 99999
#define MAX_PIECES 9

typedef int (CDECL *PPROBE_EGBB) (int player, int* piece,int* square);
typedef void (CDECL *PLOAD_EGBB) (char* path,int cache_size,int load_options);
static PPROBE_EGBB probe_egbb;

int SEARCHER::egbb_is_loaded;
int SEARCHER::egbb_load_type = LOAD_4MEN;

/*
Load the dll and get the address of the load and probe functions.
*/

#ifdef _MSC_VER
#	ifdef ARC_64BIT
#		define EGBB_NAME "egbbdll64.dll"
#	else
#		define EGBB_NAME "egbbdll.dll"
#	endif
#else
#	ifdef ARC_64BIT
#		define EGBB_NAME "egbbso64.so"
#	else
#		define EGBB_NAME "egbbso.so"
#	endif
#endif

#ifndef _MSC_VER
#    define HMODULE void*
#    define LoadLibrary(x) dlopen(x,RTLD_LAZY)
#    define GetProcAddress dlsym
#endif

int LoadEgbbLibrary(char* main_path,int egbb_cache_size) {

#ifdef EGBB
	HMODULE hmod;
	PLOAD_EGBB load_egbb;
	char path[256];
	char terminator;
	size_t plen = strlen(main_path);
	strcpy(path,main_path);
	if (plen) {
		terminator = main_path[strlen(main_path)-1];
		if (terminator != '/' && terminator != '\\') {
			if (strchr(path, '\\') != NULL)
				strcat(path, "\\");
			else
				strcat(path, "/");
		}
	}
	strcat(path,EGBB_NAME);
	if((hmod = LoadLibrary(path)) != 0) {
		load_egbb = (PLOAD_EGBB) GetProcAddress(hmod,"load_egbb_xmen");
     	probe_egbb = (PPROBE_EGBB) GetProcAddress(hmod,"probe_egbb_xmen");
        load_egbb(main_path,egbb_cache_size,SEARCHER::egbb_load_type);
		return true;
	} else {
		print("EgbbProbe not Loaded!\n");
	}
#endif
	return false;
}
/*
Probe:
Change interanal scorpio board representaion to [A1 = 0 ... H8 = 63]
board representation and then probe bitbase.
*/

int SEARCHER::probe_bitbases(int& score) {

#ifdef EGBB
	
	register PLIST current;
	int piece[MAX_PIECES],square[MAX_PIECES],count = 0;

#define ADD_PIECE(list,type) {					\
	   current = list;							\
	   while(current) {							\
	      piece[count] = type;					\
		  square[count] = SQ8864(current->sq);	\
		  current = current->next;				\
		  count++;								\
	   }										\
	};
	ADD_PIECE(plist[wking],_WKING);
	ADD_PIECE(plist[bking],_BKING);
	ADD_PIECE(plist[wqueen],_WQUEEN);
	ADD_PIECE(plist[bqueen],_BQUEEN);
	ADD_PIECE(plist[wrook],_WROOK);
	ADD_PIECE(plist[brook],_BROOK);
	ADD_PIECE(plist[wbishop],_WBISHOP);
	ADD_PIECE(plist[bbishop],_BBISHOP);
	ADD_PIECE(plist[wknight],_WKNIGHT);
	ADD_PIECE(plist[bknight],_BKNIGHT);
	ADD_PIECE(plist[wpawn],_WPAWN);
	ADD_PIECE(plist[bpawn],_BPAWN);
	piece[count] = _EMPTY;
	square[count] = 0;

	score = probe_egbb(player,piece,square);
	if(score != _NOTFOUND)
		return true;
#endif

    return false;
}
regards,
Daniel
User avatar
Kempelen
Posts: 620
Joined: Fri Feb 08, 2008 10:44 am
Location: Madrid - Spain

Re: Help compiling Scorpio Bitbases calls with MINGW 4.8.1

Post by Kempelen »

Hello Daniel,

The fix you point me didn't work for me, but I get it: in place of upgrading my copy of mingw, I deleted it and installed a new one from zero. That work. Unfortunatly, contrary at what I though, my engine compiled with 4.8.1 version is 15% slower than with 4.7.0, all options and code the same.

I will probe 6 men. I have seen there is no place to download it, but I need to compile the generator and run it. I will do it at Christmas when I have a couple of free days.

Thanks and regards
Fermín
Fermin Serrano
Author of 'Rodin' engine
http://sites.google.com/site/clonfsp/