Reputation: 1144
For the case of GCC and linux,
I wonder
if C++ library depends on C library API.
if C library includes every system calls.
if C++ library includes every system calls.
if there exist any system library which provide system calls other than C/C++ library. (I believe pthread library prodives some posix thread API)
Thank you in advance.
Upvotes: 0
Views: 222
Reputation:
if C++ library depends on C library API.
for GNU C, yes. It might be beneficial to do it that way, because a lot of C standard library functions are part of the C++ standard as well.
if C library includes every system calls.
It doesn't "include" a single one, because a system call is something exposed by the kernel. What A C library does is provide some wrappers around system calls, but no, not necessarily around all of them. There are helpers to call syscalls for which no wrapper is provided. Maybe start reading here: syscalls(2)
.
if C++ library includes every system calls.
See above.
if there exist any system library which provide system calls other than C/C++ library. (I believe pthread library prodives some posix thread API)
Yes (adding the word "wrappers" to your wording) and you already named an example. Note the POSIX thread API doesn't require kernel level threads, but it's implemented using them on Linux.
Upvotes: 3
Reputation: 375
Yes, the GNU C++ library is linked with the GNU C library.
$ ldd /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.20
linux-vdso.so.1 => (0x00007ffc1b5bc000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fb25239c000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb251fd2000)
/lib64/ld-linux-x86-64.so.2 (0x00007fb2529b3000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fb251dbc000)
Upvotes: 2