libmem
libmem copied to clipboard
Add debugging logs and more specific error return values
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.
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.
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
This is not coming out soon. For now, things either work or don't, and libmem lets you know that. No specific errors.
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