DLL track function calls
I have never used dll's before(absolutely no experience) and I wanted to replace a dll in an app with one that can somehow debug(show me in some way) what function was ca开发者_开发问答lled.
So if dll one had this type of code(again, i have no experience)
function test(var1, var2, num3){
//dosomething
}
I would replace with
dll.onfunccall = alert(call);
What you are describing is a classic application of Aspect-Oriented Programming (AOP). Depending on which language and framework you are using, there are AOP frameworks and containers whose sole function is to intercept DLL calls in the manner you describe, allowing you to perform some operation before or after the DLL call.
The canonical example is logging. Logging can potentially occur anywhere in your program, and writing code for each and every DLL call so that it can be logged gets dull in a hurry. But with an AOP framework, you can simply attach all of the DLL entry points at once, and have them each call a single logging function. This can be done in a number of different ways. Some AOP frameworks do it with method attributes. Others inject code into the DLL.
Aspect-Oriented programming is all about handling cross-cutting concerns.
See Also:
http://en.wikipedia.org/wiki/Aspect-oriented_programming
精彩评论