The message isn't printed by the library, it's printed by the shell. Processes are only notified when one of their own child processes exits. After a fork, the new process is a grandchild of the shell, so the shell doesn't know about it and doesn't print anything when it exits due to a signal.
When a child exits, the parent process is sent a SIGCHLD
signal. It can then use one of the wait()
family of system calls to get the child's termination status and the signal that killed it.