I resisted the temptation to add this to Robert Gamble's answer - consider this a supplement to it.
Be wary of simply assuming that 'any match' is OK for use. There was a case in another SO question where a piece of code was moved from Windows to Unix and the Windows code used getch()
to read a single character from the input. The user went through a process analogous to this and found getch()
on Unix in the curses
library. So, the user linked with the curses
library and wondered why the code core dumped. The trouble is, the getch()
actually used assumes that the proper initialization has been done, and the proper initialization was not done. In fact, it probably wasn't the routine that was needed.
On Solaris, there are options to nm
that tell you the library name and even object file within the library that contains the symbol (these are -r
for library name, and -R
for object within library).
Beware C++ mangled names, too. The ortho2
example is clearly not C++ mangled.