c# - standard procedure WINAPI DllMain environment .Net dynamic loading dll -


prompt how can implement analog standard procedure winapi dllmain environment. net dynamic loading. dll

bool winapi dllmain (     in hinstance hinstdll,     in dword fdwreason,     in lpvoid lpvreserved   );

i want have method in c# library executed when loaded?

there's no direct equivalence this, however, can create static class (or @ least static constructor class) executed when class used first:

 public class mylibraryfactory  {      static mylibraryfactory()      {           // add static initializer code here.           // called when class first referenced or used.      }  } 

this constructor called before other method using class. there's no guarantee first thing called inside library, compiler ensures else executes inside library independent of class, won't notice difference.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -