![](/img/trans.png)
[英]How to solve linker error "LIBCURL.LIB contains invalid OMF record, type 0x21 (possibly COFF) " in C++Builder?
[英]C++ : calling BIOS interrupt 0x21
我記得使用了一個叫做
geninterrupt(int interrupt_no)
(包含在dos.h
)以在Turbo c ++中在屏幕上顯示字符串。 現在,當我嘗試使用g ++編譯同一程序時,編譯器對我大吼大叫。
C:\Users\Krish\Documents\rough.cpp|7|error: '_AH' was not declared in this scope|
C:\Users\Krish\Documents\rough.cpp|8|error: '_DX' was not declared in this scope|
C:\Users\Krish\Documents\rough.cpp|9|error: 'geninterrupt' was not declared in this scope|
似乎它甚至無法識別寄存器。 我究竟做錯了什么。 這些功能不是c ++標准庫的一部分嗎? (我應該明確鏈接這些庫嗎?)。 如果是,怎么辦?
調用中斷以獲取打印的字符串僅在以real mode
(DOS在其下運行)下工作的x86
兼容CPU上有效。 現代操作系統在protected mode
工作,在該protected mode
BIOS中斷不再可用。
如今,控制台輸出通常由file handle
表示,您可以使用標准庫將數據發送到該file handle
,或者如果要進行低級直接內核功能,也可以將數據發送到該file handle
。 (在POSIX系統中,調用為write
)
在Linux系統調用表中,您可以使用int 0x80
下的sys_write
(您需要使用內聯匯編來填充參數並調用中斷)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.