This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

How to build a "function call logger" .dll?


Hi!

I want to build a "function call logger" .dll which could write out each
function call with the call parameters to a logfile.

Original working of a "program.exe" and "funcs.dll":

 --------------------			-------------------------
 |  program.exe     |			| funcs.dll		|
 |                  |			|			|
 |  imports: func_a <==================== exports: func_a	|
 |                  |			|			|
 --------------------			-------------------------

If I want to log what functions the "program.exe" calls I have to make
an other "funcs.dll" as a replacement. The original "funcs.dll" can be
renamed as "funcs-orig.dll".
Now this should work as follows:

 --------------------	--------------------	-------------------------
 |  program.exe     |	| funcs.dll	   |	| funcs-orig.dll	|
 |                  |	|		   |	| 			|
 |		    |	|   imports: func_a <===== exports: func_a	|
 |  imports: func_a <====exports: func_a   |	|			|
 |                  |	|		   |	|			|
 --------------------	---------|-----------	-------------------------
				 |
				\|/
			    logfile.txt

The problem is that in the new source code I have to use 2 func_a: the
first one to export to the program.exe and the second one to import from
funcs-orig.dll like this:

void func_a() {		// this is the new exported function
	// log to logfile.txt
	func_a();	// this shoud be a call to funcs-orig.dll's func_a()
}

Is it possible to make something like this?

Thanks,

	NMarci

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]