This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Regression for gdb.fortran/library-module.exp [Re: [RFA] choose symbol from given block's objfile first.]
On Mon, 14 May 2012 17:05:52 +0200, Joel Brobecker wrote:
> Is it possible to link an executable that defines a global variable
> against a shared library that also defines a global variable with
> the same name? It's something I tried on GNU/Linux, but the linker
> rejected the link.
Works for me, it is also perfectly defined this way:
echo -e '#include <stdio.h>\nint x=1;void f(void){printf("lib:%d\\n",x);}'|gcc -x c -fPIC -Wall -shared -o var.so -;echo -e '#include <stdio.h>\nint x=2;extern void f(void);int main(void){printf("main:%d\\n",x);f();return 0;}'|gcc ./var.so -x c -Wall -o var -;./var
main:2
lib:2
Thanks,
Jan