-
Notifications
You must be signed in to change notification settings - Fork 761
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
A dylib using mio on mac os x exports symbols that it probably should not. #264
Comments
This is most likely a rust issue. I will try to ping some people |
Ah, so I misunderstood the case. This is actually expected behavior. When you define a If you are going to define functions w/ So, closing with "expected behavior" :) |
That is what I did in the end. Actually, it occurred to me while coding on stream that this is actually the behavior I would expect from a C library. But shouldn't the rust linker not warn about duplicate symbols? |
There's an issue for that! rust-lang/rust#28179 |
Well, sort of. In the typical case libc is dynamically linked; in that case I'm not sure how the Rust linker could warn about such a symbol collision. In some cases it might even be intentional (e.g. if a library wishes to override libc's malloc/free). |
This made well be a rust compiler bug, I am not sure. I made a small repro case here: https://github.com/SirVer/mio_crash_test_link_mac_os (< 20 lines of code). In there, we make a dylib with one function:
and we call it through a python file using ctypes. This results in an infinite recursion, because the call to UnixSocket...connect() actually calls this connect function again. Renaming our function from connect to blub makes the test.py script run through without error.
This error does not happen on Linux, but it is very reproducible on Mac OS X. Here are reproduction steps:
This results in this stack trace:
This was discovered while live coding on the Swiboe stream while writing this commit. Has anybody an idea how to avoid name clashes like these?
The text was updated successfully, but these errors were encountered: