rdbo / libmem

Advanced Game Hacking Library for C, Modern C++, Rust and Python (Windows/Linux/FreeBSD) (Process/Memory Hacking) (Hooking/Detouring) (Cross Platform) (x86/x64/ARM/ARM64) (DLL/SO Injection) (Internal/External) (Assembler/Disassembler)
GNU Affero General Public License v3.0
784 stars 91 forks source link

Add debugging logs and more specific error return values #62

Open rdbo opened 1 year ago

rdbo commented 1 year ago

There should be some debug logs on libmem so that it gets easier to debug, and error values that can help the user to understand why that error was caused in the first place. These things could be disabled using preprocessor definitions.

rdbo commented 1 year ago

I don't think this is going to happen - it would need a lot of restructuring on libmem. Besides, errors are different depending on the OS, so it would become a bit messy anyways.

rdbo commented 1 year ago

The best way for this to happen would probably be using something like LM_GetLastError, or LM_GetLastErrorStr I'm not sure how this would be implemented though; the errors are different depending on the OS

rdbo commented 9 months ago

This is not coming out soon. For now, things either work or don't, and libmem lets you know that. No specific errors.

rdbo commented 9 months ago

For Rust, the obvious choice is using Results with a libmem-specific error type. For C++, there is a feature in C++ 23 which is similar to Rust's Result, called std::expected C++ alternate suggestions by @illegal-instruction-co

template <typename T>
struct Result{
    lm_error_result_t
    T actualResult;
}

Or std::pair