1

C++ compaird my function.

In "solaris 5.10", anything is ok! But in "solaris 5.9", if I do not have a prototype, it gives me the error "The function "atomic_add_32_nv" must have a prototype."

Please help me!

StarPilot
  • 2,246
  • 1
  • 16
  • 18
dlhzt
  • 11
  • 1
  • Do you include directly? Did you look at that file on the 5.9 system and check whether it contains that function? Did you use the same compiler on both systems? etc. Plain "help" with no details never works. – Marc Glisse Jan 14 '13 at 08:44
  • solaris 5.9, i had check it;program have it the “ #include ”, and it's function have “extern uint32_t atomic_add_32_nv(uint32_t *target, int32_t delta);”。 compiler is CC – dlhzt Jan 15 '13 at 00:51

1 Answers1

0

The atomic function support (through <atomic.h>) was added in Solaris 10, as far as I recall. Googling for "solaris 10 atomic operations" seems to support this through various hits.

On Solaris 9 you either need to provide a wrapper using mutexes (which is considerably slower than atomic operations; but may not matter to your app) or implement those functions (per processor/architecture x86/sparc, you need to support) using assembler.

You could also look around how common open source projects (e.g. apache httpd, boost) do it and go from there.

For a related discussion see this SO topic.

Community
  • 1
  • 1
Christian.K
  • 47,778
  • 10
  • 99
  • 143