为什么我们现在不能跨平台创建程序? [英] Why can't we create programs cross-platforms these days?

查看:329
本文介绍了为什么我们现在不能跨平台创建程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想知道,如果所有语言的所有编译器都将代码转换为计算机胆量中唯一被交谈"的语言(机器码-零和一),为什么要将.NET Windows应用程序传递到Mac如此困难?申请吗?

没有人会提出一个绝妙的主意(自3年前结婚以来,我就没有绝妙的主意!),并且……我不知道……一个机器代码框架,而不是……编译器转换为机器代码,它将转换为该框架,该框架将安装在任何平台上(SuSE,fsb,Ubuntu,AIX,SCO,OS X,Windows 9x,Vista,7等).

我想知道为什么这些天我们不能这么简单地做事...

有什么想法吗?

解决方案

事实上,它已经完成了.至少在一定程度上.

其中一项工作称为Java,它是一种跨平台语言. Java编译器将源代码编译为称为字节码"的东西,无非就是一种与机器无关的汇编语言".稍后,该可执行文件"由Java虚拟机(JVM)执行,而Java虚拟机是各个平台之间不同的部分(即Windows JVM明显不同于MacOS JVM).

但是,跨平台应用程序并不是那么简单.编写一个基本的VM相对简单,该VM将为每个可能的平台执行某种抽象字节码.但是,如果语言本身缺少丰富的类库,那么它实际上就算不上什么.因此,出于各种原因,实现所述类库是一件非常困难的事情.

I just wonder, if all compilers in any language transform the code into the only language "talked" in the computer guts (Machine Code - zeros and ones), why is it so hard to pass .NET windows application into a Mac application?

Shouldn't someone come with a brilliant idea (I have no brilliant ideas since I got married 3 years ago!) and have a ... I don't know ... a machine code framework so, instead of the compiler converting to machine code, it would convert to that framework, that will be installed in any platform (SuSE, fsb, Ubuntu, AIX, SCO, OS X, Windows 9x, Vista, 7, etc., etc.).

I wonder why can't we do things this easy, these days...

Any thoughts?

解决方案

In fact, it's already done. To a certain extent at least.

One of the efforts is called Java, which is a cross-platform language. Java compiler compiles source to something called "bytecode", which is nothing more than a machine-independent "assembly language". That "executable" is later executed by the Java Virtual Machine (JVM), which is the part that differs from platform to platform (that is, Windows JVM is obviously different from MacOS JVM).

However, cross-platform apps are not that simple. It's relatively simple to write a basic VM that would execute some kind of abstract bytecode for every possible platform. But the language itself is practically nothing if it lacks a rich class library. So implementing the said class library is a very hard thing for various reasons.

这篇关于为什么我们现在不能跨平台创建程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆