Linux: How to statically link against system libs?

Alexander aldem+dmars at nk7.net
Tue May 3 08:10:00 PDT 2011


On 03.05.2011 16:29, Lutger Blijdestijn wrote:

> A syscall is generally understood to be a call into the kernel for doing something that can't be done with user level privileges.

  Not really. syscalls are interface of user space to the OS kernel, and obviously, they can be made with user level privileges, otherwise nothing would be possible :)

  From the Linux syscalls manpage: "The system call is the fundamental interface between an application and the Linux kernel."

> So a call is either a syscall or it isn't, and none of kernel32 are.

  kernel32 provides Win32 API, which is exactly (from application point of view) what syscalls in Linux are. In turn, kernel32 is interfacing to ntdll, which is near direct interface to the kernel.

> There are even functions in kernel32 which do not make a syscall.

  Sure, not all of Win32 API functions require syscalls. But again: "In lots of cases, KERNEL32 APIs are just wrappers to NTDLL APIs."

  Unlike kernel32, though, libc is providing direct interface to syscalls - like open(), socket() etc. - yes, those are not libc functions, those are syscalls (wrapped a bit to follow C calling convention).

  Probably, nowadays libc has wrappers around syscalls, checking arguments etc - but those are not necessary, the difference is only in calling convention.

/Alexander


More information about the Digitalmars-d-learn mailing list