Sun Studio 12 Update 1: C++ User's Guide

Overloading Functions

When you use the identifier form, there must be exactly one function with the specified name in scope at the pragma location. Attempting to use the identifier form of #pragma weak with an overloaded function is an error. For example:


int bar(int);
float bar(float);
#pragma weak bar        // error, ambiguous function name

To avoid the error, use the string form, as shown in the following example.


int bar(int);
float bar(float);
#pragma weak "__1cDbar6Fi_i_" // make float bar(int) weak

See the Solaris Linker and Libraries Guide for more information.