[ET Trac] [Einstein Toolkit] #1376: Cactus loops endlessly if given the same name for aliased function and actual implementation
Einstein Toolkit
trac-noreply at einsteintoolkit.org
Sun Jun 2 22:55:17 CDT 2013
#1376: Cactus loops endlessly if given the same name for aliased function and
actual implementation
---------------------+------------------------------------------------------
Reporter: knarf | Owner:
Type: defect | Status: review
Priority: minor | Milestone:
Component: Cactus | Version: development version
Resolution: | Keywords:
---------------------+------------------------------------------------------
Comment (by rhaas):
Replying to [comment:1 eschnett]:
> On a related note: In this setup, there should have been two functions
called "fun", and the linker should have complained as well.
Would the linker complain with default options? The thorns and flesh
appear as libraries to the linker and multiply defined functions in
libraries are fine aren't they? This is the way one overrides eg malloc
when linking with a debugging library? A quick experiment with two
different functions "fun" in two different static libraries returns no
error. Just adding --whole-archive makes the link fail but with errors due
to libgcc so I am not doing '''that''' the right way it seems.
I have used:
{{{
==> main.c <==
int fun(int a);
int main(void) {
fun(1);
return 0;
}
==> a.c <==
#include <stdio.h>
int fun(int a) { printf("a\n"); }
==> b.c <==
#include <stdio.h>
int fun(int a) { printf("b: %d\n", a); }
gcc -c -o b.o b.c && ar -cvq libb.a b.o
gcc -c -o a.o a.c && ar -cvq liba.a a.o
gcc -o main main.c -L. -l a -l b # this uses the function in a
gcc -o main main.c -L. -l b -l a # this uses the function in b
}}}
--
Ticket URL: <https://trac.einsteintoolkit.org/ticket/1376#comment:6>
Einstein Toolkit <http://einsteintoolkit.org>
The Einstein Toolkit
More information about the Trac
mailing list