Is there a way to access code run when an assemble is loaded?

  • Thread starter Thread starter David T.
  • Start date Start date
D

David T.

Is there such a thing as a static constructor of an assembly? In other
words is there code that is called when the assembly is loaded? There must
be. Is there a way to customize this code? Is there a "DllMain" that is
called that code can be written to (i.e. customized)?

I am trying to have a message displayed when an assembly I've written is
loaded into an executable that a user writes.
 
Assemblies do not have a DLLMain, but you can subscribe to the current
domain's AssemblyLoad event. This notifies you whenever the appdomain loads
an assembly.
 
Back
Top