C运行时是否适用于任何其他程序,如lua,haskell,java等......?

时间:2021-11-14 05:52:36

From the QnA for what a runtime is : What is "runtime"?

从QnA来看运行时是什么:什么是“运行时”?

I understood about runtime a little. To make my understanding more robust, I'd like to ask new question.

我对运行时有点了解。为了让我的理解更加强大,我想问一个新问题。

Is C runtime an essential for any other programs like lua, haskell, java, etc... ?

C运行时是否适用于任何其他程序,如lua,haskell,java等......?

I know C library implements not only standard C api but also system call wrappers also.

我知道C库不仅实现了标准的C api,还实现了系统调用包装器。

And I know lua runtime is no different than just a C program. This means lua runtime is based on C runtime.

我知道lua运行时与C程序没有区别。这意味着lua运行时基于C运行时。

So I guess any other language would be in the same situation. Because it is only C rumtime which can call system calls.

所以我猜任何其他语言都会出现同样的情况。因为只有C朗姆酒可以拨打系统电话。

I considered for linux but I guess Windows and other Unix implementations must be same.

我考虑过linux,但我猜Windows和其他Unix实现必须相同。

Am I right?

我对吗?

1 个解决方案

#1


2  

Not necessarily.

不必要。

All programs written in C make use of the C runtime environment, be it the standard library, the stuff happening before the main function, or else.

用C编写的所有程序都使用C运行时环境,无论是标准库,还是主函数之前发生的事情,或者其他。

If a compiler/interpreter/virtual machine is written in C, yes, it does make use of the C runtime.
OTOH, if it isn't, it does not.

如果编译器/解释器/虚拟机是用C编写的,是的,它确实使用了C运行时。 OTOH,如果不是,它不会。

Note that you have to go up the whole "compiler/interpreter/virtual machine chain."
A Python interpreter written in Haskell might still indirectly rely on the C runtime environment if the Haskell interpreter has been written in C.

请注意,您必须完成整个“编译器/解释器/虚拟机链”。如果Haskell解释器是用C编写的,那么用Haskell编写的Python解释器可能仍然间接依赖于C运行时环境。

[...] it is only C rumtime [sic] which can call system calls.

[...]只有C rumtime [原文如此]可以调用系统调用。

No. The C runtime provides wrappers around some system calls. You can write programs in pure assembly making use of system calls and not rely on the C runtime library at all.

否.C运行时提供了一些系统调用的包装器。您可以使用系统调用以纯汇编编写程序,而不是完全依赖C运行时库。

#1


2  

Not necessarily.

不必要。

All programs written in C make use of the C runtime environment, be it the standard library, the stuff happening before the main function, or else.

用C编写的所有程序都使用C运行时环境,无论是标准库,还是主函数之前发生的事情,或者其他。

If a compiler/interpreter/virtual machine is written in C, yes, it does make use of the C runtime.
OTOH, if it isn't, it does not.

如果编译器/解释器/虚拟机是用C编写的,是的,它确实使用了C运行时。 OTOH,如果不是,它不会。

Note that you have to go up the whole "compiler/interpreter/virtual machine chain."
A Python interpreter written in Haskell might still indirectly rely on the C runtime environment if the Haskell interpreter has been written in C.

请注意,您必须完成整个“编译器/解释器/虚拟机链”。如果Haskell解释器是用C编写的,那么用Haskell编写的Python解释器可能仍然间接依赖于C运行时环境。

[...] it is only C rumtime [sic] which can call system calls.

[...]只有C rumtime [原文如此]可以调用系统调用。

No. The C runtime provides wrappers around some system calls. You can write programs in pure assembly making use of system calls and not rely on the C runtime library at all.

否.C运行时提供了一些系统调用的包装器。您可以使用系统调用以纯汇编编写程序,而不是完全依赖C运行时库。