I writed my LD_PRELOAD module and i want to add some initialization code before my overrided functions work. Maybe LD_PRELOAD have any loaded event or something like this?
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’m not sure about a “loaded” event, however if you’re using
gcc, you may find theconstructorattribute useful. Take for example:testlib.c:
#include
hworld.c:
The constructor attribute means that the function should be executed before
main(). Alternatively, if you’re using C++, you could create a static global instance of a class whose constructor does the initialization, which would achieve the same effect as usingconstructor.