-
Notifications
You must be signed in to change notification settings - Fork 839
Remove no_mangle
from new_session
#1182
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
Conversation
AFAICT the I'm not necessarily against it, but I don't quite know what the full consequences of that change would be. We also have #1151 which does the same, but for different reasons. |
I don't have a lot of context here, sorry - why would Rust projects never need to enable FFI? Cargo unfortunately doesn't allow making this attribute conditional on feature flags ... I don't feel strongly about adding
The only difference should be that cargo will no longer allow having multiple versions of |
I wonder if it makes sense to have a separate |
Basically we expose an API that can be used as part of other non-Rust projects (e.g. curl, nginx) and we build a shared library ( So my thinking was that removing the only
I thought about that and we might do it in the future, but it would be a breaking change and notifying/updating all the projects that depend on this takes time and is kind of a pain, so I don't think it will happen any time soon. |
To clarify, the |
I ran into the following error while updating quiche a while back: ``` = note: /usr/bin/ld: target/debug/deps/libquiche-aebddac5b5b78042.rlib(quiche-aebddac5b5b78042.quiche.2dd0d882-cgu.7.rcgu.o): in function `new_session': /home/builder/.cargo/git/checkouts/quiche-3a3206f14f25c564/a0088a9/quiche/src/tls.rs:1010: multiple definition of `new_session'; target/debug/deps/libquiche-7702398d4219d80f.rlib(quiche-7702398d4219d80f.quiche.1f33b6b3-cgu.5.rcgu.o):/home/builder/.cargo/git/checkouts/quiche-3a3206f14f25c564/df3fac0/src/tls.rs:1010: first defined here ``` That's not a particularly helpful error - the issue was that that we had two versions of quiche in the dependency tree. This removes the unnecessary `no_mangle` attribute from `new_session` - it's only ever used as a function pointer, so it doesn't need to have a well-known name for the linker. Eventually we might want to consider adding a `links` attribute, or consider separating the FFI bits into a new `quiche-sys` crate, but I don't have time to drive that currently.
25fd7ce
to
8548ead
Compare
Got it - I do think it's worth working towards that |
links = "quiche"
to Cargo.tomlno_mangle
from new_session
Merged, thanks @jyn514! |
I ran into the following error while updating quiche a while back:
That's not a particularly helpful error - the issue was that that we had two versions of quiche in
the dependency tree. This removes the unnecessary
no_mangle
attribute fromnew_session
-it's only ever used as a function pointer, so it doesn't need to have a well-known name for the linker.
Eventually we might want to consider adding a
links
attribute, or consider separating the FFI bitsinto a new
quiche-sys
crate, but I don't have time to drive that currently.