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