Author: Robert Hyatt
Date: 08:46:34 01/20/04
Go up one level in this thread
On January 20, 2004 at 06:11:12, Steve Maughan wrote:
>I have been having problems linking assembler routines into Monarch. I'm using
>Visual Studio .NET 2003. The following routine runs with no problems:
>
>int bsf(bitboard a)
>{__asm
> {
> bsf eax, dword ptr[a + 4]
> add eax, 32
> bsf eax, dword ptr[a]
> }
>}
>
>No doubt many will recognize it as the classic "Bit Scan First" routine.
It is a "classic bit scan first with potential bugs" implementation. :)
It depends on undefined behavior that could change at any time. It assumes
that the second BSF instruction won't change eax if no bits are set. This is
_not_ guaranteed.
>However if I add a '__forceinline' or '_inline' before the 'int' I get the
>following errors when the program links (it generates code with no errors):
>
>Linking...
>board.obj : error LNK2019: unresolved external symbol _bsf referenced in
>function _clear_board
>checks.obj : error LNK2001: unresolved external symbol _bsf
>genmove.obj : error LNK2019: unresolved external symbol _bsf referenced in
>function _generate_black_evade_check
>test.obj : error LNK2001: unresolved external symbol _bsf
>Release/Monarch.exe : fatal error LNK1120: 1 unresolved externals
>
>What am I doing incorrectly? I've looked through the project options and cannot
>identify any options to 'tick'.
>
>All help appreciated!
>
>Steve Maughan
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.