سؤال

Today I was in a discussion involving that libraries dont have an entry point.Generally the executable loads the libraries and the entry point is the main in the executable itself.

Are there execeptions wherein the libraries themselves can have an entry point ??

Update:

@sgr91 explained that DllMain is the entry point in Windows! What about linux ? Or is it just a feature of Windows ?

هل كانت مفيدة؟

المحلول

Yes, dynamic libraries do have entry-points. It may be named differently (may or may not be exposed for usage), based on compiler and OS.

For Linux:

void attribute ((constructor)) my_init(void);

void attribute ((destructor)) my_fini(void);

The _init and _fini sections are now obsolete.

Read more

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top