public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Problem with mixed VC++ , gnu-win32 object files and link
@ 1997-03-07 12:06 REINKLA
  0 siblings, 0 replies; only message in thread
From: REINKLA @ 1997-03-07 12:06 UTC (permalink / raw)
  To:         -         (052)gnu-win32(a)cygnus.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@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1997-03-07 12:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-03-07 12:06 Problem with mixed VC++ , gnu-win32 object files and link REINKLA

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).