Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Noting the Optimizations greatly influence the result #297

Open
HerrNamenlos123 opened this issue Aug 12, 2023 · 0 comments
Open

Noting the Optimizations greatly influence the result #297

HerrNamenlos123 opened this issue Aug 12, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@HerrNamenlos123
Copy link

HerrNamenlos123 commented Aug 12, 2023

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.

@HerrNamenlos123 HerrNamenlos123 added the bug Something isn't working label Aug 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant