smbwrapper/smbsh

Derrell.Lipman at UnwiredUniverse.com Derrell.Lipman at UnwiredUniverse.com
Fri Dec 13 18:48:00 GMT 2002


David Collier-Brown -- Customer Engineering <David.Collier-Brown at Sun.COM> writes:

> Derrell.Lipman at UnwiredUniverse.com wrote:
>
>> It appears I've nearly got it solved (unless another big problem turns up
>> after I fix this one).  Aside from my initialization routine not be called
>> early enough, thus providing some null function pointers, 
>
>  Hmmn, In a different discussion group I once wrote:
> ---
>   The plugin uses a set of NULL pointers and a check
> in each interceptor to do initialization, as Linux
> lacks #pragma init(name-of-init-function).
>   This is inefficient (and inelegant).
>
> ...
> 
> .section .init
>         call vgPlain_startup
>
> This is used with the gnu linker option  -z initfirst,
> and ensures that the .init section is run first.

Thanks.  I actually already found a different way to do that.  I pass the
"-init" option to the linker via the gcc command line:

  -Wl,-init=smbw_initialize

By default, the linker causes the function _init() to be called when it loads
a new shared library, but crt0i.o is being linked in the shared library which
contains its own _init() function.  I declare my smbw_initialize() function
like this to accommodate whatever crt0i's _init() function is doing:

    extern void _init(void);            /* a pre-existing _init() function */
    static void initialize(void);       /* our own initialization function */

    void smbw_initialize(void)
    {
            _init();
            initialize();
    }

In another message to be posted shortly, I'll describe some substantial
changes I'm making, and ask some advice.

Derrell



More information about the samba-technical mailing list