खोज…


परिचय

द रूस्ट स्टैंडर्ड लाइब्रेरी ( std ) को केवल मुट्ठी भर आर्किटेक्चरों के खिलाफ संकलित किया गया है। इसलिए, अन्य आर्किटेक्चर (जो एलएलवीएम का समर्थन करता है) को संकलित करने के लिए, रस्ट प्रोग्राम पूरे std का उपयोग नहीं करने का विकल्प चुन सकता है, और इसके बजाय इसका केवल पोर्टेबल सबसेट का उपयोग कर सकता है, जिसे द कोर लाइब्रेरी ( core ) के रूप में जाना जाता है।

#! [no_std] नमस्कार, विश्व!

#![feature(start, libc, lang_items)]
#![no_std]
#![no_main]

// The libc crate allows importing functions from C.
extern crate libc;

// A list of C functions that are being imported
extern {
    pub fn printf(format: *const u8, ...) -> i32;
}

#[no_mangle]
// The main function, with its input arguments ignored, and an exit status is returned
pub extern fn main(_nargs: i32, _args: *const *const u8) -> i32 {
    // Print "Hello, World" to stdout using printf
    unsafe { 
        printf(b"Hello, World!\n" as *const u8);
    }

    // Exit with a return status of 0.
    0
}

#[lang = "eh_personality"] extern fn eh_personality() {}
#[lang = "panic_fmt"] extern fn panic_fmt() -> ! { panic!() }


Modified text is an extract of the original Stack Overflow Documentation
के तहत लाइसेंस प्राप्त है CC BY-SA 3.0
से संबद्ध नहीं है Stack Overflow