www.delorie.com/archives/browse.cgi | search |
> I suppose it's too early to call it non-standard without strong > evidence. For now, you have found that it's somehow incompatible with > ida and/or watcom linker, though i did test linking x.o with > watcom-compiled test.obj using wlink and everything worked fine. The solution is to use non-static variables only. The Watcom linker will then link properly. I still think the file is non standard though. Here is an example that shows the problem: file a.c: (compile with gcc) static int a; void function1_(void) { a=123; } file b.c: (compile with gcc) static int b; int function2_(void) { return b;} file test.c: (compile with Watcom) #include <stdio.h> extern void _function1(void); extern int _function2(void); void main(void) { _function1(); printf("%d\n",_function2()); } It will print 123 even if b was never given a value. This is because a and b are linked to the same memory position. If the variables a and b are public you will get the expected 0. BTW, don't use -fno-common. If you do it, even non-static variables are linked at the same memory position. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |