[英]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.