-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Libdl.dlclose incorrectly assumes 0 is success on all platforms #25137
Comments
I suppose we just assume that there's very little you can do to recover from an error during cleanup. Anyways, can you submit a PR to change the return value of |
In case you're not sure where that is, Jameson is asking you to make this line do the right thing. :) |
Ah right. I was assuming jdjohnston had already found that from the quality of the report, but should probably try to avoid being as cryptic. |
My initial thot was that it would be good to have jl_dlclose behave like the underlying OS system calls and account for the difference in Libdl.dlclose. But there really isn't enough benefit to that to go forward with that approach. Besides a one character addition to jl_dlclose would be simpler, more elegant, more efficient, more ... :) PR should be up later today or tomorrow at the latest. (I'm running out of 'Net time today.) Something this simple and already discussed doesn't need to marked WIP, right? |
Right, feel free to just open the PR directly, and ping myself or Jameson for a merge. |
- Invert boolean value returned by Windows FreeLibrary so it matches that of POSIX dlclose - Add test of jl_dlclose/Libdl.dlclose to test/libdl.jl
@vtjnash @staticfloat, Please consider PR #25175. One note: besides the 1-character fix in I realize that a unit test wasn't requested and if need be, I'll gladly retract it from the PR. |
Libdl.dlclose returns true iff the return of the lower-level ccall is zero. However, Windows uses the opposite convention for FreeLibrary (which is what dlload.c/jl_dlclose calls on WIndows): success is non-zero.
Maybe Libdl.dlclose could use something like:
I also noted that while Libdl.dlclose is used in test/libdl.jl, it is never tested.
Maybe also jl_dlclose should, for Windows
if (!handle) return 0;
The text was updated successfully, but these errors were encountered: