Giter VIP home page Giter VIP logo

Comments (5)

bjorn3 avatar bjorn3 commented on August 30, 2024 1

The same happens if you implement the function in a static library you link into the dylib. Rustc doesn't know that the function is defined within the dylib, so it doesn't mark it as exported in the version script.

from rust.

folkertdev avatar folkertdev commented on August 30, 2024

I think that behavior is fine in theory: there is no way for rust to know that the symbol is defined. but I believe there is currently a way to force the exporting of the symbol. E.g. this does not work

std::arch::global_asm! {
    ".global foo",
    "foo:",
    "ret",
}

extern "C" {
    #[export_name = "foo"]
    pub fn foo();
}

because

8 |     #[export_name = "foo"]
  |     ^^^^^^^^^^^^^^^^^^^^^^
9 |     pub fn foo();
  |     ------------- not a free function, impl method or static

So could it be a solution to provide a way to explicitly export the symbol?

from rust.

bjorn3 avatar bjorn3 commented on August 30, 2024

global_asm and static libraries should probably be handled the same for symbol export. You could look at the issue for the staticlib version of this behavior if such an option is already suggested.

from rust.

capickett avatar capickett commented on August 30, 2024

@bjorn3 would you mind linking the staticlib issue? I could not find it, unless you meant #104707 although that looks like the opposite problem to this one (too many exported symbols vs not enough).

from rust.

bjorn3 avatar bjorn3 commented on August 30, 2024

#78827, rust-lang/rfcs#2771, rust-lang/rfcs#3556

from rust.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.