So this is the scenario that I'm looking at:
所以这就是我正在看的场景:
I have 3 libraries - A, B and C.
我有3个库 - A,B和C.
- Library A implements function
foo()
and exposes it as an API. - Function
foo()
calls the POSIXwrite()
call to write some data. - Library B writes a wrapper to the
write()
glibc call using the linker -wrap option. - Library C links to both A and B.
库A实现函数foo()并将其公开为API。
函数foo()调用POSIX write()调用来写一些数据。
库B使用linker -wrap选项将包装器写入write()glibc调用。
库C链接到A和B.
Any write()
call that the library C makes will get intercepted by the wrapper library B. But, my question is, if library C calls foo()
, will the write()
call inside foo() get intercepted by B?
库C所做的任何write()调用都会被包装库B拦截。但是,我的问题是,如果库C调用foo(),foo()内的write()调用是否会被B拦截?
1 个解决方案
#1
2
If A
is linked with -wrap=write
, foo
will call the wrapper. If it's not, it won't.
如果A与-wrap = write链接,foo将调用包装器。如果不是,它就不会。
The same is true about calls to write
in C
. There's no difference whatsoever between A
and C
as far as calling write
is concerned.
关于用C语言编写的调用也是如此。就调用write而言,A和C之间没有任何区别。
#1
2
If A
is linked with -wrap=write
, foo
will call the wrapper. If it's not, it won't.
如果A与-wrap = write链接,foo将调用包装器。如果不是,它就不会。
The same is true about calls to write
in C
. There's no difference whatsoever between A
and C
as far as calling write
is concerned.
关于用C语言编写的调用也是如此。就调用write而言,A和C之间没有任何区别。