address space problem on dynamically linked libs

From: Dave (davis_eric_at_yahoo.com)
Date: 05/15/04

  • Next message: Kasper Dupont: "Re: address space problem on dynamically linked libs"
    Date: 14 May 2004 22:36:17 -0700
    
    

    Hi, there
    Got a weird problem on dlls under unix/linux

    Say I have a the following codes in my kernel:
    namespace name_space{
            class_name& get_object() {
                    static class_name object_of_the_class;
                    return object_of_the_class;
            }
    }

    Then in the dll *.so file, I have the following codes:
    a_object = name_space::get_object()

    Also in more than once place in my kernel, I have similar codes as:
    b_object = name_space::get_object()

    Since the object returned by "get_object" function is static, I
    expected
    a_object has the same address as b_object. But it turned out to be not
    true.
    The object obtained from dll *so file is a different object from that
    obtained within kernel codes. All the calls in kernel codes are
    refering to the same object.

    Could any one points out why and how to make both dll *so and kernel
    refer
    to the same objects?

    Thanks


  • Next message: Kasper Dupont: "Re: address space problem on dynamically linked libs"

    Relevant Pages