Re: Is there a way to execute code on Assembly loading?
- From: "Ben Voigt [C++ MVP]" <rbv@xxxxxxxxxxxxx>
- Date: Mon, 12 Nov 2007 10:31:21 -0600
"Simon Egli" <simon_egli65@xxxxxxxxxxx> wrote in message
news:13fad$47328017$544a4183$30309@xxxxxxxxxxxxxxxxxx
Hello,
I have an assembly A that implements additional features for another
assembly B and should link itself automatically into the mechanisms of B
when it is loaded. Is there a way to get code executed in assembly A
without explicitly calling a method in A?
Yes and no.
No, because assembly A won't be loaded until you call a method in A. Yes,
because using type initializers (static constructor or .cctor) you can run
code of your choice before any other method is called for the first time.
If you are loading assembly A via reflection (Assembly.Load or
Assembly.LoadFrom) then place a custom attribute on assembly A to designate
an entrypoint that the plugin loader should call. You'll have to add this
feature to the plugin loader, but it will end up being reusable.
Thanx,
Simon
.
- References:
- Is there a way to execute code on Assembly loading?
- From: Simon Egli
- Is there a way to execute code on Assembly loading?
- Prev by Date: Re: Searching URL String for Subdomain value
- Next by Date: Re: Searching URL String for Subdomain value
- Previous by thread: Re: Is there a way to execute code on Assembly loading?
- Next by thread: Re: Pointers in VC.Net
- Index(es):
Relevant Pages
|
Loading