You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Okay, sorry if this is the wrong place to write this, but I just tore my hair out for hours because it didn't work and I don't want anyone else to do the same thing. I am new to this library, but it worked quite well even without much knowledge.
Detouring worked fine for me for normal functions, but I also wanted to detour class member functions. I spent hours of trying around. I then found the 'member' example in this repository, happy that there is a resource, and spending another handful of hours because it didn't work either. Not even copying the code 1:1 in my project worked. I was so frustrated, I already wanted to create an issue that the example doesn't work. Then I saw that the examples include tests, so I called nmake test, and that DID work!
Even more frustrated I spent more time digging into the makefiles, and at some point I finally found out it was the optimizations. In my Visual Studio projects the Optimizations were by default /O2, which for some reason makes normal function detouring work, but class member function detouring not. Disabling the Optimizations to /Od now makes my project work, including the example code.
Don't get me wrong, I like this library and I am truly amazed how clean and polished everything seems, despite the fact it is operating on replacing assembly code. Thank you for this amazing open-source library.
I just wish this fact about optimizations was written in the Readme and on pretty much every Wiki page as a colored disclaimer on the bottom. Correct me if I didn't even look at the actual documentation but everything I could find was the repos readme and the Wiki in this Github Repo. Microsoft pages were not really helpful, this is all of the proper documentation I could find.
The text was updated successfully, but these errors were encountered:
Describe the bug
Okay, sorry if this is the wrong place to write this, but I just tore my hair out for hours because it didn't work and I don't want anyone else to do the same thing. I am new to this library, but it worked quite well even without much knowledge.
Detouring worked fine for me for normal functions, but I also wanted to detour class member functions. I spent hours of trying around. I then found the 'member' example in this repository, happy that there is a resource, and spending another handful of hours because it didn't work either. Not even copying the code 1:1 in my project worked. I was so frustrated, I already wanted to create an issue that the example doesn't work. Then I saw that the examples include tests, so I called
nmake test
, and that DID work!Even more frustrated I spent more time digging into the makefiles, and at some point I finally found out it was the optimizations. In my Visual Studio projects the Optimizations were by default /O2, which for some reason makes normal function detouring work, but class member function detouring not. Disabling the Optimizations to /Od now makes my project work, including the example code.
Don't get me wrong, I like this library and I am truly amazed how clean and polished everything seems, despite the fact it is operating on replacing assembly code. Thank you for this amazing open-source library.
I just wish this fact about optimizations was written in the Readme and on pretty much every Wiki page as a colored disclaimer on the bottom. Correct me if I didn't even look at the actual documentation but everything I could find was the repos readme and the Wiki in this Github Repo. Microsoft pages were not really helpful, this is all of the proper documentation I could find.
The text was updated successfully, but these errors were encountered: