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

rustc on linux seems not to export pub extern fns #18577

Closed
flo-l opened this issue Nov 3, 2014 · 2 comments
Closed

rustc on linux seems not to export pub extern fns #18577

flo-l opened this issue Nov 3, 2014 · 2 comments

Comments

@flo-l
Copy link
Contributor

flo-l commented Nov 3, 2014

I'm on Linux, kernel 3.16.6-203.fc20.x86_64 (64 bit).

[me@localhost test]$ rustc --version
rustc 0.13.0-nightly (b87619e27 2014-11-02 23:27:10 +0000)

test.rs:

fn test(bla: i32) -> i32 { bla*bla }

#[no_mangle]
pub extern "C" fn _test_wrapper(i: i32) -> i32 {
  test(i)
}
[me@localhost test]$ rustc --crate-type dylib test.rs
[me@localhost test]$ nm -g libtest.so 
00000000002014e0 B __bss_start
                 w __cxa_finalize@@GLIBC_2.2.5
00000000002014e0 D _edata
00000000002014e8 B _end
0000000000000808 T _fini
                 w __gmon_start__
00000000000005f0 T _init
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
                 w _Jv_RegisterClasses
0000000000201030 D rust_metadata_test_7bb26f1eacd843be
                 U rust_stack_exhausted

I hope I haven't made some completely obvious mistake, but I think _test_wrapper should show up under exported symbols.

@alexcrichton
Copy link
Member

Hm, the same steps for me have it show up, perhaps something is odd with the local linker/gcc?

$ cat foo.rs
fn test(bla: i32) -> i32 { bla*bla }

#[no_mangle]
pub extern "C" fn _test_wrapper(i: i32) -> i32 {
  test(i)
}
$ rustc --crate-type dylib foo.rs
$ nm -g libfoo.so
00000000000024df A __bss_start
                 w __cxa_finalize
00000000000024df A _edata
00000000000024e4 A _end
00000000000007c8 T _fini
                 w __gmon_start__
00000000000005b0 T _init
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
                 w _Jv_RegisterClasses
0000000000002020 D rust_metadata_foo_17a5f6ae9433831f
                 U rust_stack_exhausted
0000000000000740 T _test_wrapper
$ rustc -v
rustc 0.13.0-nightly (b87619e27 2014-11-02 23:27:10 +0000)

@flo-l
Copy link
Contributor Author

flo-l commented Nov 3, 2014

Ok I copied your code and it works! ;)

Sorry for the trouble, I probably had a typo or so! Thanks for the fast response!

I'm going to close that issue as it's resolved ;)

@flo-l flo-l closed this as completed Nov 3, 2014
lnicola added a commit to lnicola/rust that referenced this issue Dec 11, 2024
…-atb

Remove redundant associated type bounds from `dyn TypeFolder`
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