How to disable a DLLs init() when using dlopen() ?
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > How to disable a DLLs init() when using dlopen() ?




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    How to disable a DLLs init() when using dlopen() ?  
Adrian B.


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-29-04 12:52 PM

I have a shared lib I'm opening with dlopen() but do not have access
to its source code.  It automatically executes an init fn on loading
(and fini() in exiting) which do stuff I want to disable.  Is there
any way to do this programatically?

Thanks
AB





[ Post a follow-up to this message ]



    Re: How to disable a DLLs init() when using dlopen() ?  
Måns Rullgård


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-29-04 12:52 PM

borg@swirve.com (Adrian B.) writes:

> I have a shared lib I'm opening with dlopen() but do not have access
> to its source code.  It automatically executes an init fn on loading
> (and fini() in exiting) which do stuff I want to disable.  Is there
> any way to do this programatically?

You could use objcopy to rename those symbols to something harmless.

--
Måns Rullgård
mru@kth.se





[ Post a follow-up to this message ]



    Re: How to disable a DLLs init() when using dlopen() ?  
Paul Pluzhnikov


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-30-04 07:48 AM

Måns Rullgård <mru@kth.se> writes:

> borg@swirve.com (Adrian B.) writes:
> 

No, not really.
[vbcol=seagreen]
> You could use objcopy to rename those symbols to something harmless.

At least on ELF systems, these symbols are not referenced by the
dynamic loader "by name"; rather their address is recorded in the
the PT_DYNAMIC header as DT_INIT and DT_FINI at link time.

Renaming the _init/_fini will not do the OP any good.

OTOH, binary-editing the .dynamic section and setting DT_INIT/DT_FINI
to some other "harmless" address should do the trick.

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 11:35 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register