Date: Mon, 03 Jul 2000 21:40:21 +0100 From: David Malone <dwmalone@maths.tcd.ie> To: freebsd-hackers@freebsd.org Subject: Global variables defined several times. Message-ID: <200007032140.aa37554@salmon.maths.tcd.ie>
next in thread | raw e-mail | index | archive | help
I've just noticed that usr.bin/ftp/ftp_var.h defines a large selection of global variables, and then this header file is included in multiple C source files. I thought this should lead to one copy of the global varible per source file, and then a warning or error at link time due to symbols being defined multiple times. This doesn't seem to be the case with the toolchain - you seem to get one copy of each variable for the final linked unit. I tested this with some different compilers and linkers - SAS/C on the Amiga and CodeWarrior on the Mac seem to complain about the symbols turning up twice. AIX and Digital Unix's compilers seem to have the same behavior as the FreeBSD toolchain. I guess this means it's a traditional Unix feature? I did look at the object files with nm, and it shows these symbols with type "C" - unfortunately this isn't explained in the nm or objdump man pages, and there doesn't seem to be an obvious place to look in the rest of the info pages. David. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi? <200007032140.aa37554>