Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Help with msvc port?

Author: Dieter Buerssner

Date: 14:38:55 07/04/04

Go up one level in this thread


On July 04, 2004 at 17:22:10, Scott Gasch wrote:

>I am having two issues porting my engine to MSVC.  I wonder if anyone here has
>had similar problems and has any advice.
>
>The first is more serious: when I interface with Eugene's egtb.cpp code I have
>to set my project's default calling convention to fastcall in order to make it
>work.  If I do not do this then I hit access violations in egtb code that
>appears to believe its arguments were passed in ecx and edx when in fact the
>calling code seems to have placed them (all) on the stack:

Do you have a correct prototype in place, where the function is called (not only
where it is defined)?

Something like:


#if defined (_MSC_VER)
#define TB_FASTCALL     __fastcall
#else
#define TB_FASTCALL
#endif

#define  T_INDEX64
#if defined (T_INDEX64) && defined (_MSC_VER)
typedef unsigned __int64 INDEX;
#elif defined (T_INDEX64)
typedef unsigned long long INDEX;
#else
typedef unsigned long INDEX;
#endif

typedef unsigned int square;

typedef INDEX (TB_FASTCALL * PfnCalcIndex)
                (square*, square*, square, int fInverse);

extern PfnCalcIndex PfnIndCalcFun (int, /*color*/int);
extern int TB_FASTCALL L_TbtProbeTable (int, /*color*/int, INDEX);


/* And use PfnIndCalcFun and L_TbtProbeTable only after above is seen by the
compiler */

BTW. Would be nice, when Eugene's code came with a little header of all the
"exported" declarations/prototypes/...


Regards,
Dieter



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.