-
Notifications
You must be signed in to change notification settings - Fork 27
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
Not working on mac #13
Comments
Is this when the program is existing or when does it happen? It may be related to this in that case rust-lang/rust#28794 |
Sorry, I've not been clear enough... |
The issue with the TLS happens even if you just have simple function on mac that just returns a value really but it should only be a problem when unloading. Also you say the tests passes. Do you think you can try to change your dylib to do something similar to what the test is doing (just returning an |
Ok, i made some tests, those are the function signatures I tested and the results: It doesn't makes sense to me, but a String parameter is the party stopper. |
Are you really sure it's valid to return Rust values in this way in over a dll border? I would guess the problem here is that the String is allocated inside the dll which has a own "copy" of the allocator and then it tries to gets freed on the Rust non-dll side which a pointer that the application knows nothing about (or the other way around) In my case I have always made sure that the dll makes and owns it's allocations internally and I never return Rust objects directly and only keeping it using a C API. |
I don't know, I'm not an expert about dylibs. |
Yeah I think the problem is that the function will try to free the string on exit but it's the application that has allocated it. No problem. I think this is a general problem with sending data to dll functions and it should be unrelated to how dynamic_reload works as it doesn't know what is going on inside the dlls. |
I will close this issue for now as I don't think it's related to dynamic_reload. If you investigate more and it seems to be the case please re-open or file a new issue. |
Yes, it seems to be OS related, because on linux it was working fine... |
Passing a ref should be fine as it's the sender that owns the memory. I would be very careful with returning Rust objects from the dll tho as it may cause similar issues. |
Sorry for the poor title,
I'm using your crate do enable dynamic loading of modules for my application.
It works fine on linux, tested on a physical gentoo and a docker debian 9.3
On OSX 10.13 High SIerra (haven't tested on other versions) it fails with:
The dylib itself is a Rust written lib, and it passes the tests without problems.
The text was updated successfully, but these errors were encountered: