Thanks J, Thats exactly what I am doing at present, but maintainability is the problem with this approach. This assembly continuously get extended, so need to find a permanent solution. Any other suggestion. Has any one tried call using dllMain in mixed mode assembly in dotnet 2. Btw I am using \CLR:OldSyntax crl.
> Date: Fri, 2 Feb 2007 15:19:44 -0500> From: [EMAIL PROTECTED]> Subject: Re: > [ADVANCED-DOTNET] Assembly Load> To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM> > > At 12:38 PM 2/2/2007, Amrender Singh wrote (in part)> >My assembly needed a > notification internally when some other assembly load my assembly.> >> >I > have tried initializing in dllmain , but for some reason after migrating from > .net1.1 to .net 2 my dllMain function doesn't get called. Any suggestion > welcome.> > You can have a "static constructor" in your class (a method > declared static that has the same name as your class); it's guaranteed to be > called before any instances of the class are created and before any of the > static members of the class are referenced.> > If you don't know which class > you make available to callers will be instantiated first and the work you > need to do is not associated with any particular class, build a class that > has a static method that does the work you need done. Call that static method > from the static constructors of all your other classes. If you need to make > sure that the code doesn't run more than once, protect it with a boolean > that's set by the first call so it doesn't do any work when called the 2nd > etc time.> > http://msdn2.microsoft.com/en-us/library/k9x6w0hc.aspx> > > > > > J. Merrill / Analytical Software Corp> > ===================================> > This list is hosted by DevelopMentorĀ® http://www.develop.com> > View archives > and manage your subscription(s) at http://discuss.develop.com _________________________________________________________________ Get connected - Use your Hotmail address to sign into Windows Live Messenger now. http://get.live.com/messenger/overview =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com