www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/12/24/03:10:21

Message-Id: <199612240755.JAA09429@pegasus.marques.co.za>
From: "Graeme Pyle" <graeme AT marques DOT co DOT za>
To: "DJGPP mailing list" <djgpp AT delorie DOT com>
Subject: Windows LFN support
Date: Mon, 23 Dec 1996 02:36:11 +0200
MIME-Version: 1.0

hi,

i was working on a project in rhide earlier today when i started getting
strange "re-definition errors" from gcc. i eventually solved them, but
their causes were really interesing:

say you have 3 source files - "main.cc", "12345678-a.cc" and
"12345678-b.cc" with the following code:

**** main.cc ****

#include "12345678-a.cc"
#include "12345678-b.cc"

main() {
}

**** 12345678-a.cc ****

void test() {
}

**** 12345678-b.cc ****

void test2() {
}

when you try to create the files from the command prompt
========================================================
in a windows 95 dos box:
------------------------

	copy con 12345678-a.cc

and

	copy con 12345678-b.CC

work just great, but

after "restarting in ms-dos mode"
---------------------------------

	copy con 12345678-a.cc

works fine, however

	copy con 12345678-b.cc
	
prompts you with an overwrite confirmation, which is clearly the result of
microsoft's sad LFN implementation

(for backward compatibility, i think - and what the hell is it with them
and backward compatibility??? correct me if i'm wrong, but the 286 had
protected-mode (in the days of dos 3.3) and dos v7 still has the 640kb
limit!!! its enough to drive a man insane!)

anyway, if you make "12345678-a.cc" and "12345678-b.cc" in a dos box,

	gcc -c main.cc -o main.o

gives you

	12345678-b.cc: In function `void test()':
	In file included from main.cc:2:
	12345678-b.cc:1: redefinition of `void test()'
	12345678-a.cc:1: `void test()' previously defined here

in a dos box and after leaving windows. obviously, the directive

	#include "12345678-a.cc"

is stripped to

	#include "12345678.cc"

and the same with "12345678-b.cc", which gives you a "main.cc" with the
following contents:

**** main.cc ****

#include "12345678.cc"
#include "12345678.cc"

main() {
}

*****************

which would explain the re-definition errors as 12345678-a.cc is included
twice. (function test() is defined twice)

i don't know if there is something i'm missing, or if this hasn't been
addressed in djgpp (or if gcc -lfn -c main.cc would work... and i will slap
myself if it does), but i thought i should point it out because it really
drove me mad (i almost flamed dj delorie and robert hoene ;-P ):

when rhide re-directs gcc's error message, it doesn't know that
"12345678-a.cc" is included twice, and because of

	12345678-b.cc:1: redefinition of `void test()'

it highlites line 1 in 12345678-b.cc which has the definition for test2(),
complaining that it re-defines test() - bummer!

this is "technically" (very technically ;) ) a rhide bug because it doesn't
realize gcc can't handle the LFNs. then again, gcc should. and then again,
microsoft should've... and that's what it all boils down to - incompetance
at microsoft! (blah blah blah......)

i really hope i haven't missed anything that fixes all of this, because
then i've wasted a lot of time.

cheers,

Graeme

p.s. thanks dj (i don't know your first name) for the great compiler and
robert for hard-work on the IDE - you guys are very cool :)

/==============================================\
| GRAEME                                 (Oo)  |
|      (graeme AT marques DOT co DOT za)             \/   |
|----------------------------------------------|
| WEB: http://www.marques.co.za/clients/graeme |
| IRC: KiloGram on irc.is.co.za                |
\==============================================/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019