简体   繁体   English

C#编译器/链接器选项:CSC.exe,类似于gcc中的--wrap吗?

[英]C# compiler/linker option: CSC.exe, somthing similar to --wrap in gcc?

In gcc, when we specify -Wl , --wrap=function_name , it replaces all the calls to "function_name" with "__wrap_function_name" and expects user to provide definition for "__wrap_function_name". 在海湾合作委员会,当我们指定-Wl--wrap=function_name ,它取代所有以“函数名”与“__wrap_function_name”的呼吁,并希望用户为“__wrap_function_name”提供的定义。 It renames the original method as "__real_function_name". 它将原始方法重命名为“ __real_function_name”。

This helps to hook any function in source code and of course we can call real method if we want. 这有助于在源代码中挂接任何函数,当然,如果需要,我们可以调用真实方法。

is there similar option in C# compiler/linker ? C#编译器/链接器中是否有类似的选项? I am trying to override some functions in managed dll. 我试图覆盖托管dll中的某些功能。 I have source code for that dll. 我有该dll的源代码。 I can't use any available mocking frameworks as my methods are internal and non-virtual. 我无法使用任何可用的模拟框架,因为我的方法是内部的和非虚拟的。

No, I'm not aware of any such feature in C# in general or the Microsoft implementation in general. 不,我不了解C#或Microsoft实现中的任何此类功能。

If you've got the source code already, can you not change it appropriately? 如果您已经有了源代码,您是否可以适当地更改它? It sounds like you want it to be more extensible than it is - so add extensibility hooks yourself. 听起来您希望它比现在更具可扩展性-因此请自己添加可扩展性挂钩。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM