GithubHelp home page GithubHelp logo

Comments (5)

vi avatar vi commented on May 28, 2024 1

Shall I try to prepare a Hello World example with libstd, without println!, without libc?

from min-sized-rust.

johnthagen avatar johnthagen commented on May 28, 2024

@vi That totally sounds in scope for this repo as I think it's an important distinction. At the very least, it should be added to the README.

So would we have to print Hello World like:

    // Since we are passing a C string the final null character is mandatory.
    const HELLO: &'static str = "Hello, world!\n\0";
    unsafe {
        libc::printf(HELLO.as_ptr() as *const _);
    }

Or is there a way to print to stdout from within libstd or libcore? Ideally, if we didn't have to do C FFI in this next layer of example, that would be ideal (and portable to Windows).

from min-sized-rust.

johnthagen avatar johnthagen commented on May 28, 2024

Sure! Please make it as another subproject similar to the existing project layout.

from min-sized-rust.

danielhenrymantilla avatar danielhenrymantilla commented on May 28, 2024

Regarding FFI and C string literals, would you be interested in my making ::byte-strings and its c_str! macro support no_std?
It currently does not since it generates a &'static CStr, but it wouldn't be too hard to make it return a *const ::libc::c_char

from min-sized-rust.

johnthagen avatar johnthagen commented on May 28, 2024

@danielhenrymantilla That's interesting -- nice crate. I'm not sure if this repository necessarily needs to be the location for where the latest and greatest FFI crates are. byte-strings looks pretty cool, but probably out of scope for usage of this repository.

from min-sized-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.