Help - Minix

This is a discussion on Help - Minix ; Hello everyone, I think when we invoke dlopen, the method which has attribute __attribute__ ((constructor)) should be called, and then we invoke dlclose, the method which has atrrribute __attribute__ ((destructor)) should be called. But in my situation, method __attribute__ ((constructor)) ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Help

  1. Help

    Hello everyone,


    I think when we invoke dlopen, the method which has attribute
    __attribute__ ((constructor)) should be called, and then we invoke
    dlclose, the method which has atrrribute __attribute__ ((destructor))
    should be called.

    But in my situation, method __attribute__ ((constructor)) is called
    when my whole program starts and __attribute__ ((destructor)) is called
    when my whole program terminates -- other than being invoked when I
    call dlopen/dlclose.

    Could anyone give some suggestions that how to solve this problem? What
    are the check points?

    Thanks


  2. Re: Help

    csheppard91 wrote:
    > Hello everyone,
    >
    >
    > I think when we invoke dlopen, the method which has attribute
    > __attribute__ ((constructor)) should be called, and then we invoke
    > dlclose, the method which has atrrribute __attribute__ ((destructor))
    > should be called.
    >
    > But in my situation, method __attribute__ ((constructor)) is called
    > when my whole program starts and __attribute__ ((destructor)) is called
    > when my whole program terminates -- other than being invoked when I
    > call dlopen/dlclose.
    >
    > Could anyone give some suggestions that how to solve this problem? What
    > are the check points?
    >
    > Thanks
    >


    "method"? - I was unaware that there was a successful port of a C++ or
    Java compiler to MINIX yet.

  3. Re: Help

    Hello,
    taken from GNU GCC Official manual
    (http://gcc.gnu.org/onlinedocs/gcc-3....ributes.html):

    """
    constructor
    destructor
    The constructor attribute causes the function to be called
    automatically before execution enters main (). Similarly, the
    destructor attribute causes the function to be called automatically
    after main () has completed or exit () has been called. Functions with
    these attributes are useful for initializing data that will be used
    implicitly during the execution of the program.
    """

    Goodbye,
    --
    Gaetano Sferra


+ Reply to Thread