Home > Back-end >  How Linux let me define functions performed before the program is loaded dynamic library?
How Linux let me define functions performed before the program is loaded dynamic library?

Time:03-16

My program myPro code defines a function I void printVersion ();
My program dependence dowork. So;

How to make my function printVersion myPro load dowork. So before?

CodePudding user response:

GCC compiler, using __attribute__ ((__constructor__)) modify your function,

CodePudding user response:

reference 1st floor SDGHCHJ response:
GCC compiler, using __attribute__ ((__constructor__)) modify your function,

This not line, this will only make my function printVersion before the main execution, and can't let it is loaded. So before the execution

CodePudding user response:

Dynamic loading so library?
https://blog.csdn.net/u013919153/article/details/88976804

Want to load the loading, don't want to load without load,

CodePudding user response:

The
reference 3 floor zjq9931 response:
,

Not ah
  • Related