On 29.04.2011 11:41, Spacen Jasset wrote:

> You still *cannot* link statically to kernel32.dll. That's the difference. 
> Linux glibc contains the C library functions *and* the syscalls, which is the 
> bit that causes the problems.

  But at least I know, that no matter where I am, as long as I am using 
kernel32 only (no more dependencies), it will work on *any* Windows system 
(obviously, keeping backward compatibility in mind - something compiled on 
WinXP will work on all later
versions) - which is not he case of Linux/glibc, unfortunately.

> msvcrt.dll and msvcrt.lib don't have any syscalls in them. they call though 
> kernel32.dll dynamically.

  Actually, they do. Calling kernel32 is like making a syscall, that's the base 
of Win32 API, which is equivalent of Linux syscall.

> The answer therefore on linux as it is on windows: do not to statically link 
> anything that calls the kernel, which in this case is glibc

  As there alternatives exists (like mentioned uClibc), which can be linked 
statically - this is more policy than technical limitation. glibc still can be 
linked statically, and will work - but it becomes *very* dependent on other 
stuff, which is
dynamic only (sometimes) - that's why developers do not want to support static 
versions.

> I don't know about any of that. All I say is software was built on Centos 3 
> and it runs on the then company I was working for supported platforms.

  That's the keyword - "supported platform". In Windows world, any version is 
"supported" - in Linux world, OTOH - there are dozens of platforms, sharing 
same kernel but hardly compatible.

> libc is designed to be forward compatible only, if you dynamically link it. 
> The symbols within are versioned and the correct ones bound at runtime.

  Probably you mean "backward compatible"? Forward compatibility means that all 
previous versions will accept applications compiled with newer versions, which 
is obviously not the case of glibc.

  So I'd say that unless and until *any* binary compiled on *any* Linux 
distribution (same or newer kernel version) will be accepted by all other Linux 
systems (I bet it will never happen though), it is a bit too early to rule out 
static linking.

/Alexander

Reply via email to