This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Problem with mixed VC++ , gnu-win32 object files and link

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]