Some questions about libc, libc++, libstdc++
Intel offers Parallel STL implementation to GNU libstdc++
The same offer was made to libc++.
More on reddit.comCan someone elaborate on what are libc, libc++, libstdc++
-
What the difference between libc++ and libstdc++? Why can't we just use one of them for all times?
-
How to determine which versions of these libs support specific standard version? For example which version of c++ standard does libstdc++-4.6 support?
-
Can i just "copy-paste" these libs into target OS to run my project if that OS lacks newer versions of these ones available in repositories?
-
Can i just "copy-paste" all dependent `.so` files into target OS? What should i consider when "copy-pasting" libraries from my development workstation to user's one?
-
libstdc++ provides run-time support for user-space C++ applications. What is in that library is implementation specific, and may change from one release to the next one. You shouldn't probably rely on what is there.
Putting theory aside, shared libraries always export symbols such as functions and/or data. There are a number of tools you can use to see those symbols. One of those is nm; it would display the dynamic symbols if you specify -D argument. So let's do it on libstdc++.so. (The list is quite big, so I've used head -20 to limit it.)
$ nm -D /lib64/libstdc++.so.6 | head -20
U abort
U __assert_fail
000000386565d2b0 T atomic_flag_clear_explicit
000000386565d2f0 T __atomic_flag_for_address
000000386565d2a0 T atomic_flag_test_and_set_explicit
000000386565d2c0 T __atomic_flag_wait_explicit
U bindtextdomain
U btowc
U __ctype_get_mb_cur_max
000000386565dd10 T __cxa_allocate_dependent_exception
000000386565dae0 T __cxa_allocate_exception
U __cxa_atexit
000000386565df10 T __cxa_bad_cast
000000386565df50 T __cxa_bad_typeid
000000386565dfe0 T __cxa_begin_catch
000000386565eb10 T __cxa_call_unexpected
000000386565f160 T __cxa_current_exception_type
000000386565fa00 T __cxa_deleted_virtual
0000003865668990 T __cxa_demangle
000000386565e050 T __cxa_end_catch
Those are just some functions provided by the C++ runtime. In the above case, most of them are those implementing Exception Handling according to Itanium C++ ABI.
Also note that C++ names could be mangled, so for example you can run into something that looks like _ZSt9has_facetISt7codecvtIwc11__mbstate_tEEbRKSt6locale. It could be pretty hard to demangle it yourself to understand what it means. So there is another tool called c++filt that can help with this, for example calling it as c++filt _ZSt9has_facetISt7codecvtIwc11__mbstate_tEEbRKSt6locale.
You could even use it to demangle any symbol that appears to be mangled, as in nm -D /lib64/libstdc++.so.6 | c++filt.
Of course, this would work with any shared object and not only C++ runtime.
If you really want to have the list of function that are explicitly defined in the library, you may use the nm command on the library file :
nm -D -C -g --defined-only /usr/lib/gcc/x86_64-linux-gnu/4.6/libstdc++.so | less
If will be huge, exhaustive... But it shows you what is exported.