3
  1. If I want to link with pthread, I can -lpthread,right?
  2. I still don't see the reason to use -rdynamic after reading the manual..
new_perl
  • 7,345
  • 11
  • 42
  • 72

1 Answers1

3
  1. -pthread is shortcut for -D_REENTRANT -lpthread. On Linux. It is shortcut for whatever is appropriate on other platforms where the library may be called differently. See this question.
  2. Well, I think -rdynamic is explained quite well in the manual. It is needed if you want to have dynamic symbol information in an executable, which is useful for getting backtrace (in absence of debug information) and using dlsym to find symbols dynamically (e.g. GtkBuilder's autoconnect uses this).
Community
  • 1
  • 1
Jan Hudec
  • 73,652
  • 13
  • 125
  • 172
  • @new_perl: You can use `dlsym` from shared library and/or plugin (which is shared library) to your heart's desire. It's only the rare case of using `dlsym` on the executable itself and there may be other options that imply exporting the symbols too. – Jan Hudec Aug 02 '11 at 19:11
  • Can you elaborate why GtkBuilder's autoconnect uses that? – new_perl Aug 03 '11 at 00:55
  • @new_perl: It has XML with the widget declarations and it may include names of functions that should handle events (signals). And it uses `dlsym` to get the functions and connects them to the signals. – Jan Hudec Aug 03 '11 at 08:29