> On 7 Oct 2016, at 15:43, Ken Thomases <k...@codeweavers.com> wrote: > > On Oct 7, 2016, at 2:19 AM, Gerriet M. Denkmann <g...@mdenkmann.de> wrote: >> >> I need (just for debugging purposes) to count something in a thread safe >> way. >> […] >> So I tried OSIncrementAtomic. >> Now I get: "Implicit declaration of function 'OSIncrementAtomic' is invalid >> in C99" and the linker fails, because it does not find it. >> #import <libkern/OSAtomic.h> does not help at all. > > These problems are all because you're using the wrong name. > > If you #import <libkern/OSAtomic.h> then you get the declaration of > OSAtomicIncrement32() (among other things). Note this is not the name you > tried (OSIncrementAtomic). If you use the right name, the compiler warning > and linker error will go away.
You are completely right. Following your advice everything works perfectly. I just typed “OSIncrementAtomic” into Xcode Help and was informed that the proper way to use it is: SInt32 OSIncrementAtomic(volatile SInt32 *address); The I tried OSAtomicIncrement32 and was told: “No Results”. This is slightly irritating (and explains why I was using the wrong name). Thanks a lot for your help! Kind regards, Gerriet. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com