sync_add_and_fetch problem

David Daney ddaney@caviumnetworks.com
Thu Dec 4 00:14:00 GMT 2008


Charles Crisler wrote:
> Hello GCC! I am trying to compile/link/run some code that uses
> sync_add_and_fetch().

The real name of this function is __sync_add_and_fetch().

See: http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Atomic-Builtins.html

> The dynamic linker is failing to load one of my
> libraries because this function cannot be resolved. I thought that this
> function was included with GCC 4.1 and later. I have Fedora 9 32-bit on
> an x86 system with GCC version 4.3.0 20080428. Where should I look to
> fix or go around this problem? Thank you! Chuck Crisler

If you are compiling all the code in your program, including the 'one of 
my libraries', *and* you use the proper function names, then it should work.

You need to post a small, complete, and runnable testcase for us to be 
able to help much more.

David Daney



More information about the Gcc-help mailing list