Subject: Problem with mixed VC++ , gnu-win32 object files and link
From: [email-masked]

7 Mar 1997 16:03:24 -0800
Approved: [email-masked]
Distribution: cygnus
Message-ID: <0004900000527017000002L072*.cygnus.gnu-win32@MHS>
Original-To: "        -         (052)gnu-win32(a)cygnus.com" <[email-masked]>
Original-Sender: [email-masked]

     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
"[email-masked]" with one line of text: "help".