Undefined initfini symbol: foo - Aix

This is a discussion on Undefined initfini symbol: foo - Aix ; Hi all, Can somebody tell me how to resolve this error message: Undefined initfini symbol: foo. I have a C function in foo.c void foo_() { printf("This is FOO"); } and I have a f77 FORTRAN fortran program in test.f ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Undefined initfini symbol: foo

  1. Undefined initfini symbol: foo

    Hi all,

    Can somebody tell me how to resolve this error message:

    Undefined initfini symbol: foo.


    I have a C function in foo.c
    void foo_()
    {
    printf("This is FOO");
    }


    and I have a f77 FORTRAN fortran program in test.f

    PROGRAM test
    call foo
    End

    $ravi> gcc -export-dynamic foo.c
    $ravi> ar -r libfoo.a foo.o
    $ravi> xlf -b initfini:foo_ test.f -lfoo
    ERROR: Undefined initfini symbol: foo
    ld: 0711-317 ERROR: Undefined symbol: .foo

    How to export Symbols??

    Thanks for any replies in advance.


    --
    Ravi.T


  2. Re: Undefined initfini symbol: foo

    On Oct 29, 2:10 pm, ravi wrote:
    > Hi all,
    >
    > Can somebody tell me how to resolve this error message:
    >
    > Undefined initfini symbol: foo.
    >
    > I have a C function in foo.c
    > void foo_()
    > {
    > printf("This is FOO");
    >
    > }
    >
    > and I have a f77 FORTRAN fortran program in test.f
    >
    > PROGRAM test
    > call foo
    > End
    >
    > $ravi> gcc -export-dynamic foo.c
    > $ravi> ar -r libfoo.a foo.o
    > $ravi> xlf -b initfini:foo_ test.f -lfoo
    > ERROR: Undefined initfini symbol: foo
    > ld: 0711-317 ERROR: Undefined symbol: .foo
    >
    > How to export Symbols??
    >
    > Thanks for any replies in advance.
    >
    > --
    > Ravi.T


    I wanted to call foo as constructor routine before entering program
    aswell as in the fortran program.


  3. Re: Undefined initfini symbol: foo

    ravi wrote:
    > Hi all,
    >
    > $ravi> gcc -export-dynamic foo.c
    > $ravi> ar -r libfoo.a foo.o
    > $ravi> xlf -b initfini:foo_ test.f -lfoo
    > ERROR: Undefined initfini symbol: foo
    > ld: 0711-317 ERROR: Undefined symbol: .foo
    >
    > How to export Symbols??


    1) The initfini routine should be indicated in the module in which the
    code resides. Since I'm not sure what the -export_dynamic option does in
    gcc, I can't tell whether you're compiling or building a shared module.
    So we don't know whether the binder option is in the right place.

    2) It looks like the symbol is 'foo_', not 'foo'. Use
    nm -pBC foo.o | grep ' [BD] ' | grep foo
    to see the real symbol name

    --
    -------------------------------------
    http://www.photo.net/photos/garyrhook
    Vocatus atque non vocatus deus aderit

+ Reply to Thread