Fix shared library creation on Sun Studio

Closes GH-1260.