function linked but not getting called.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • maaveerar_pingpong@yahoo.com.hk

    #1

    function linked but not getting called.

    Hello all,

    I am using GCC version 3.4.3 on a Linux 2.6 Kernel based machine.

    I have a library of classes in an partially (incremenally?) built
    object file, i.e. linked using -Ur option. I link this to a shared
    library. One of classes in the object library, has an inline fuction
    which is called from the shared lib as shown below. This inline
    function All projects compile and link without errors.

    class classA
    {
    map<string, object*>::table ;
    }

    inline object* classA::getObje ct("key")
    {
    return table["key"];
    }

    Below function is in a shred lib calls the above in a partially linked
    library.

    classA foo;

    object = foo.getObject() ;
    object <- is null

    Since the linker did not complain, I assumed the function was properly
    inlined into the shared lib and everything is hunky dory. But it does
    not seem so. When I step through, the line is executed however the
    return value is always NULL. If I remove the inline and make it part of
    the library, it correctly returns the object.

    -thanks a bunch

Working...