[comp.sys.ibm.pc.programmer] <Simple> TCC question

minar@reed.bitnet (Nelson Minar,(???)) (03/28/90)

I have the following programs, that need to be linked together into one
executable:

driver.c
data.c

driver.c contains function main() and calls functions that are part of
data.c, and these functions are prototyped properly with a #include "data.h"
inside the body of driver.c

I want to compile this thing explicitly in 2 steps, first the .obj and then
the .exe (this is really going on inside a make, but the problem is the same
either way) I try the following commands:

tcc -c driver.c                          : properly creates driver.obj
tcc -c data.c                            : properly creates data.obj
tcc driver.obj data.obj                  : should link the two, and build the
                                           executable.

Instead, tlink (from inside tcc) complains that the some of the functions
driver.c do not exist. These are the functions declared in data.c.  For some
reason, the linker does not know about the existence of the data.c functions.

order doesn't seem to matter, as "tcc data.obj driver.obj" fails just the same.

however, if I do all the compilation in one step:
tcc driver.c data.c
everything works dandy. But I need to build it in two steps..

Am I being as stupid as I think I am? This usage seems to work just fine in
cc on a Unix system.

(for those curious, I am using a makefile something like the following:

driver.exe: driver.obj data.obj
	tcc driver.obj data.obj

driver.obj: driver.c data.h
	tcc -c driver.c

data.obj: data.c data.h
	tcc -c data.c


Thank you.