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

Generic functions can't call external C functions #15533

Closed
o11c opened this issue Jul 8, 2014 · 1 comment
Closed

Generic functions can't call external C functions #15533

o11c opened this issue Jul 8, 2014 · 1 comment

Comments

@o11c
Copy link

o11c commented Jul 8, 2014

Code of the general form:

extern { fn foo(); }

pub fn call_foo<T>() { foo(); }

will not allow other crates to use call_foo, because they don't link directly against the library that foo is defined in.

The solution is probably to emit wrappers or aliases for the C function in the dylib itself.
(I am not concerned about rlibs.)

A full testcase is at: https://gist.github.com/o11c/3cedbabc14adcb3e5254 (tested on Linux)

@alexcrichton
Copy link
Member

Closing as a dupe of #15460

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants