This is the mail archive of the glibc-linux@ricardo.ecn.wfu.edu mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

_init, ctors processing, getting argc/argv


I need to modify Winelib in order to support MFC.  Specifically, I need
to
fully initialize Wine prior to the constructors of MFC being invoked.

I can do this by invoking the Wine initialization code from
a constructor within the Wine shared object, which is invoked
prior to the MFC constructors (I've tested it and it works).

However, in order for Wine to be properly initialized, I need
access to argc and argv.

Unfortunately, with glibc, AFAIK, there is no proper way to gain
access to argc/argv from within a constructor.

However, I believe that the following approach would work:
    1.  Create my own _init routine within the Wine shared
          object (which receives argc, argv, and environp)
    2.  Have my _init routine replicate all critical
          processing as given in sysdeps/.../init-first.c
          (which I believe consists only of running my ctors
            list manually).

Questions:
    1.  I have not yet convinced myself that I correctly
         understand this process.  Is it the case that
         at process load time, we load each .so in
         breadth order, then invoke the _init code
         expressed in init-first.c, which then in turn
         walks the ctors list for that .so?

    2.  Will this work, does it seem reasonable, or have I
          missed something obvious?

    3.   Should I prod someone to ask for a mod to glibc so
           that a more formal and proper way to access command
           line arguments from constructors can be created?

Thanks for listening.

Jeremy



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]