Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: [OT] Inlining Assembler in C - Linking Problems

Author: Anthony Cozzie

Date: 09:19:11 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.
>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 is sort of a shot in the dark, but you could try

static forceinline int bsf()
{

}

in one of your header files, and see if that works.

anthony



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.