tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

How does NetBSD deal with name conflicts in user program and shared library



Hi,

As suggested by Martin in netbsd-users, I repost this problem here.

Recently I encountered a strange behavior when there are name
conflicts in user program and shared libraries.

Following is a demo:

#include <stdio.h>
#include <stdlib.h>

void write(void)
{
       exit(3);
}

int main(void)
{
       puts("hello");

       return 0;
}

When I run this program in Linux box, "hello" echoed to stdout
successfully. But in NetBSD, program exit with status 3. It seems that
when ld links `puts', it uses `write' defined in this program instead
of the one defined by the system.

It is a desired behavior?


Thanks,
Xin Wang


Home | Main Index | Thread Index | Old Index