Closed ghost closed 7 years ago
+1 Would be very useful!
It's been done once before and I think I can dig up the changelist but it has very big problems and implications, which is why it's not there now:
In short, I see that it could be useful, it would be dangerous to use even on unoptimized debug builds as the compiler may have inlined or omitted something, it would cause major performance issues if you actually were to use it and its interface is confusing. So as far as I'm concerned it's a no.
Thanks for the detailed explanation.
I'm starting to use HippoMocks to help unit testing our product. It would be great if we can have this feature optional. I totally understand the few problems you listed out, however I find our unit test environment has none or less of the problems:
Will update documentation with rationale why this is not going to be added. It's an often requested feature but it's too likely to cause trouble for most users.
If you disagree, feel free to fork the project though.
I have wrote test example to mock member function to prove It's possible. Can You add more comfortable way to do such mocks? Member functions do not differ very much from free functions, so why not to intercept it the same way? They have __thiscall calling conversion, which can be intercepted exactly by the same "jmp" instruction as common function.