memlib
memlib copied to clipboard
Replace useless NilAccessDefect with useful LibraryError
First of all, thank you for yet another great library!
I wanted to contribute at least a bit, by fixing an issue I found when testing this library. 😃
Thank you for this PR! My questions:
- How do you let
LoadLibraryA(cname)
raise a NilAccessDefect? bad DLL? - Is there other codes that cause useless exception instead of LibraryError for bad DLL?
Thank you for this PR! My questions:
- How do you let
LoadLibraryA(cname)
raise a NilAccessDefect? bad DLL?- Is there other codes that cause useless exception instead of LibraryError for bad DLL?
- To be honest, I'm still puzzled. After this Patch, it's telling me that it can't find "KERNEL32.dll" -- even though, this should be impossible, as far as I understand.
- Yes, there are other places in the code that could be improved by replacing NilAccessDefect with something meaningful, but I did not know about the others yet, when I opened this PR.
If you think this method for making more useful exceptions is helpful, perhaps it would be even better if all places where a NilAccessDefect could possibly be found would be improved by a more meaningful exception, in the same way as done in this commit (try catch all the possible failures)?
To put all this in context: I was playing around with the openssl
example, because I wanted to test if I can embed the library into the executable with memlib
. However, I am still struggling to get it to work.