Problem with mixed VC++ , gnu-win32 object files and link
REINKLA@frmail.frco.com
REINKLA@frmail.frco.com
Fri Mar 7 12:06:00 GMT 1997
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".
More information about the Cygwin
mailing list