[pups] Stupid question..

Martijn van Buul pino at dohd.org
Tue Jan 16 00:53:15 AEST 2001


I'm playing around with a /53 running 2.11BSD, trying to port some 
software, and I have a (probably stupid) problem: environ.

When I write a simple program like

#include <stdio.h>

extern char **environ;

void main(argc, argv)
int argc;
char **argv;
    printf("Hello world!");

and compile & link it using cc ("cc -o test test.c"), things go fine, 
however if I link things manually ("cc -c test.c ; ld -o test test.o -lc")
I get an unresolved _environ. By some experimentation, I noticed that
including /lib/crt0.o in the linker helps to some extent - however,
the binary generated by cc works like a charm, while the manually
linked version quits with a bus error. Any ideas?

    Martijn van Buul -  Pino at dohd.org - http://www.stack.nl/~martijnb/
	 Geek code: G--  - Visit OuterSpace: mud.stack.nl 3333
   Kees J. Bot: The sum of CPU power and user brain power is a constant.

Received: (from major at localhost)
	by minnie.cs.adfa.edu.au (8.9.3/8.9.3) id JAA08435
	for pups-liszt; Tue, 16 Jan 2001 09:22:57 +1100 (EST)
	(envelope-from owner-pups at minnie.cs.adfa.edu.au)

More information about the TUHS mailing list