所以我很困惑。我正在閱讀「從頭開始編程」一書,並正在使用庫。x86程序集 - printf不打印沒有「 n」
printf工作得很好,只要我在字符串中包含「\ n」,但沒有它,它將不會打印任何東西。
任何想法爲什麼發生這種情況?
代碼:
.section .data my_str: .ascii "Jimmy Joe is %d years old!\n\0" my_num: .long 76 .section .text .globl _start _start: pushl my_num pushl $my_str call printf movl $1, %eax movl $0, %ebx int $0x80
此外,當我使用-m elf_i386 32位模式和-dynamic - 銜接/lib/ld-linux.so.2 -lc鏈接,我得到的警告
LD:搜索-lc
時候如果有什麼差別,或者如果任何人有任何建議,如何把它加載32跳過不兼容/usr/lib64/libc.so位庫直接。
謝謝!
你的'printf'代碼在哪裏?如果它在庫中,你是否檢查過API文檔? –
@MikeW我真的不知道如何檢查它從哪裏加載。我附加了如何將庫鏈接到OP。我嘗試過搜索以發現任何類似的問題,或者如何解決鏈接警告,但我很快就會發現。我發現很難搜索所有不同版本的Assembly Assembly幫助。 – Bitani
[爲什麼printf在調用之後不刷新,除非換行符在格式字符串中?](http://stackoverflow.com/questions/1716296/why-does-printf-not-flush-after-the- call-unless-a-newline-is-in-the-format-strin) –