www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/11/11:10:03

From: Waldemar Schultz <schultz AT ma DOT tum DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Linker warning
Date: Fri, 11 Aug 2000 16:23:54 +0200
Organization: [posted via] Leibniz-Rechenzentrum, Muenchen (Germany)
Lines: 57
Message-ID: <39940C7A.7BC45478@ma.tum.de>
References: <3992D37A DOT D0274FA6 AT ma DOT tum DOT de> <glq5pskesd9njjpdlja7mr1e8pp1q7nd1o AT 4ax DOT com> <3993A4C0 DOT D972C04D AT ma DOT tum DOT de> <8n0uad$e1i$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE>
NNTP-Posting-Host: pcritter10.mathematik.tu-muenchen.de
Mime-Version: 1.0
X-Trace: wsc10.lrz-muenchen.de 966003852 3552 131.159.69.74 (11 Aug 2000 14:24:12 GMT)
X-Complaints-To: news AT lrz-muenchen DOT de
NNTP-Posting-Date: 11 Aug 2000 14:24:12 GMT
X-Mailer: Mozilla 4.73 [de]C-CCK-MCD DT (Win98; U)
X-Accept-Language: de,en,en-US
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I think I found it. Seems to be a linker bug in bnu2.10, since the effect
was not reproduceable using bnu2.95.1

The reason is that there is a structure-element named 'head'
in <bios.h> which needed to be included at a certain step
of the project. So I boiled it down, here are the facts:
 
DJGPP in DOS-box Win98

C:\usr\test\src>gcc -v
Reading specs from e:/djgpp/lib/gcc-lib/djgpp/2.952/specs
gcc version 2.95.2 19991024 (release)

ld -v
GNU ld version 2.10 (with BFD 2.10)

C:\usr\test\src>gcc -g bug.c glob.c
e:/djgpp/bin/ld.exe: Warning: type of symbol `_head' changed from 14 to 20 in
c:/temp\ccQF4F3x.o
                     ^^^^^^^^
C:\usr\test\src>cat bug.c =======file 1
#include <bios.h>
          ^^^^^^
/*#define GLOBALS_G*/
#include "glob.h"

int main(void) {
 head=NULL;
 foo();
 return 0;
}

C:\usr\test\src>cat glob.c =======file 2
#define GLOBALS_G
#include "glob.h"
void foo(void) {
}

C:\usr\test\src>CAT glob.h =======file 3
#ifdef GLOBALS_G
 #define EXT
#else
 #define EXT extern
#endif

#include <stdio.h>

EXT int *head; /*global variable*/

might be it is bad style to do it as above, but should work though.
when you exchange the GLOBALS_G lines in bug.c anf glob.c the warning disappears
when <bios.h> is not #included the warning disappears also.
please try to verify. Thanks
-- 
 Gruss Waldemar Schultz.
 Technische Universität München, Zentrum Mathematik M1, D 80290 München
 Tel: +49 (0)89 2892 8226        FAX: +49 (0)89 2892 8228

- Raw text -


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