delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/03/07/16:03:24

From: REINKLA AT frmail DOT frco DOT com
Subject: Problem with mixed VC++ , gnu-win32 object files and link
7 Mar 1997 16:03:24 -0800 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <0004900000527017000002L072*.cygnus.gnu-win32@MHS>
Original-To: " - (052)gnu-win32(a)cygnus.com" <gnu-win32 AT cygnus DOT com>
Original-Sender: owner-gnu-win32 AT cygnus DOT com

     I am using win95, gnu-win32  V17.1 and VC++ V4.2.

     global (initialised) data in C-code, compiled with gnu-win32, is not
     always linked together by the MS link program.

     Best illustrated by a minimal example:
     /*------- file1.c: compiled with VC++ ------------------*/
     #include <stdio.h>
     extern double getb();
     void main()
     {
        printf("b is %f\n", getb());
     }
     /*------- file1.c: end ----------------------------------*/
     /*------- file2.c: compiled with gnu-win32---------------*/
     double b=1.2345;
     double getb()
     {
        return b;
     }
     /*------- file2.c: end ----------------------------------*/

     file1.obj and file2.obj are linked to a 32 bit console application.
     The result is not as expected;

     The debugger shows that getb() references memory 16 bytes higher in
     memory then the place were the value is actually stored. 16 is not
     magic: in other examples the offset is different. It seems to be equal
     to the size of the .text segment.

     If the variable is defined in another file, either file1.c - compiled
     with VC++ - or in another file but without any code and compiled with
     gnu-win32 then there seems to be no problem.

     Rein Klazes.
-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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