[Mono-devel-list] Trigger some internal action based on attributes for a method?

Okehee Goh okehee at gmail.com
Mon Jun 27 14:52:00 EDT 2005


I wonder how I can support this: 
 When a method is entered and starts executing ,
  	  I'd like to implicitly call another method  or an internal
function defined inside of CLR
(What I'd like to do is to notify CLR certain information telling that
the method being executed now is the one CLR should monitor..)

Seems there is 'hook' approach.
But I don't want users to customize their methods into certain format
in order to insert the hook.

So, I checked out Attributes because users can simply add
corresponding attribute in front of the method definition. But, seems
that the metadata information declared through Attribute is accessed
through reflection in managed code only.  Users' managed code calls
some reflection to ask the type of attribute.
However, is there a way that CLR internal can use the attribute like
hook function?

If Attributes are not proper for that, how about event listener?

I searched the archive of the mailing list. There was a mail-thread
"Implementing attribute-based code generation" in Jan. I wonder
whether there has been evolved activities for that since that?

Regards,



More information about the Mono-devel-list mailing list