Skip to content
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

Automatic linking of extern mods is not effective #3502

Closed
brson opened this issue Sep 15, 2012 · 6 comments
Closed

Automatic linking of extern mods is not effective #3502

brson opened this issue Sep 15, 2012 · 6 comments
Labels
A-linkage Area: linking into static, shared libraries and binaries

Comments

@brson
Copy link
Contributor

brson commented Sep 15, 2012

// This tries to link to a library called foo
extern mod foo { }

I believe that I override the automatic linkage more often than not, sometimes even inserting bogus extern mods just to have a place to stuff linker arguments

#[nolink]
#[link_args = "-lwhatever"]
extern mod foo { }

Perhaps we can remove the automatic linking behavior and replace it with a richer set of linker attributes that can be specified either on extern mods or the crate as appropriate. There are quite a lot of bindings out there now, so we can look through them for use cases.

@brson
Copy link
Contributor Author

brson commented Sep 15, 2012

It's a shame that our link attribute is dedicated to specifying linkage metadata.

@brson
Copy link
Contributor Author

brson commented Sep 15, 2012

Maybe extern mod is going away completely in favor of extern blocks.

@graydon
Copy link
Contributor

graydon commented Sep 19, 2012

Yeah, I think extern blocks + some finer-grained linkage attributes crafted to be either platform-and-linker-neutral or configurable by target might be a way forward.

@brson
Copy link
Contributor Author

brson commented Mar 14, 2013

There have been some additional wrinkles lately. rustc now tries to propagate link args to downsteam crates, I believe in quite an ad-hoc way, filtering arguments it thinks won't work correctly.

@brson
Copy link
Contributor Author

brson commented Jun 27, 2013

Link names are no longer derived automatically now that there are no extern mods. There's more design to do with foreign linkage but maybe this specific issue can close.

@brson
Copy link
Contributor Author

brson commented Jul 19, 2013

Closing.

@brson brson closed this as completed Jul 19, 2013
RalfJung pushed a commit to RalfJung/rust that referenced this issue Apr 25, 2024
…alfJung

windows: basic support for GetUserProfileDirectoryW

Fixes rust-lang/miri#3499
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries
Projects
None yet
Development

No branches or pull requests

2 participants