How are I/O library routines implemented for languages which does not support low-level access?
Languages which don't support low level access to the machine, such as memory-mapped I/Os, often (if not always) have library routines which provides such access. Now开发者_高级运维, if the language itself does not support such access, how are these library routines implemented?
It really depends on the language. Some languages have an "interop" facility which allows a method written in that language to call a library primitive that can be implemented in another language (C, assembler, etc.).
For example, .NET languages have the P/Invoke facility that allows them to call unmanaged DLLs (that can be written in C, C++, assembler, or any other language that allows exported functions from DLLs), but for internal CLR use there's also the "internal call" modifier which is a direct call into a library primitive implemented inside one of the CLR DLLs.
精彩评论