C#程序符合C标准吗? [英] Is C# program C-Standard compliant?

查看:79
本文介绍了C#程序符合C标准吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用C#拧一个程序。打算使用该程序的人要求我将程序作为DynamicLink库提供,该库与Standard C和Unity3.5兼容,并且不依赖于平台(OS)。



他们希望程序可以在Windows,Linux和Android上运行。



使用VS2010为X86编写的C#dll程序是否满足他们的需求?

I am wring a program in C#. The folks that intend to use the program have requested that I provide the program as a DynamicLink library which would be compatible with Standard C and Unity3.5 and which does not rely on a platform (OS).

They want the program to work on Windows, Linux and Android.

Will the C# dll program written for X86 using VS2010 fulfill their demands?

推荐答案

没有。你需要在目标上安装.NET框架 - 这意味着.NET四个窗口,单声道用于Linux,可能还有Xamarin.Android用于android - 后者不是免费的(事实上它对我来说太贵了)



如果没有它,它就不会工作。
No. You would need to install the .NET framework on the target - which means .NET four windows, mono for Linux, and probably Xamarin.Android for android - the later is not free (in fact it''s damn expensive to my mind)

Without that, it won''t work.


没办法。 C#与C完全无关,只遵循一些基本的语法特性。



C#适用于CLR平台,因此可以在许多底层平台上工作,包括Windows,Linux,Mac OS X,iOS,Android等。最常用的非Microsoft实现称为Mono:

http://en.wikipedia。 org / wiki / Mono_%28software%29 [ ^ ],

http://www.mono-project.com/ [ ^ ]。



CLR平台不必安装在某些本机平台上。有些平台只在硬件上实现CLR,没有任何底层操作系统:SharpOS,CosmOS,Microsoft Singularity,新平台正在兴起。



与C相比,C#标准化得更严格,它与实现相关的功能要少得多(几乎没有)。在ECMA(ECMA-334)和ISO(ISO / IEC 23270:2006)下是标准化的。请参阅:

http://en.wikipedia.org/wiki/C_Sharp_%28programming_language %29 [ ^ ],

http://www.ecma-international.org/publications/standards /Ecma-334.htm [ ^ ],

http://standards.iso。 org / ittf / PubliclyAvailableStandards / c042926_ISO_IEC_23270_2006(E).zip [ ^ ]。



-SA
No way. C# is totally unrelated to C, only follows some of the rudimentary syntactic features.

C# works on CLR platform, and, hence, can work on many underlying platforms, including Windows, Linux, Mac OS X, iOS, Android, and more. Most used non-Microsoft implementation is called Mono:
http://en.wikipedia.org/wiki/Mono_%28software%29[^],
http://www.mono-project.com/[^].

CLR platforms does not have to by installed over some "native" platform. There are platforms implementing only CLR, on top of hardware, without any "underlying" OS: SharpOS, CosmOS, Microsoft Singularity, new platforms are emerging.

In contrast to C, C# is standardized much more strictly, it has much less implementation-dependent features (practically none). Is is standardized under ECMA (ECMA-334) and ISO (ISO/IEC 23270:2006). Please see:
http://en.wikipedia.org/wiki/C_Sharp_%28programming_language%29[^],
http://www.ecma-international.org/publications/standards/Ecma-334.htm[^],
http://standards.iso.org/ittf/PubliclyAvailableStandards/c042926_ISO_IEC_23270_2006(E).zip[^].

—SA


你应该C onsider直接使用 C 编程语言来构建动态库:它可能是实现所需兼容性的最简单方法。

(即使使用 C 不会自动保证可移植性,例如 Linux 动态库和 Windows 那些是完全不同的。但是,通过条件编译和链接,您可以为两个平台构建正确的目标。)
You should consider using directly the C programming language to build the dynamic library: it is possibly the simplest way to achieve the requested compatibility.
(Even using C does not automatically warrants portability, for instance, Linux dynamic libraries and Windows ones are quite different. However with conditional compilation and linking you may build the right targets for both platforms).


这篇关于C#程序符合C标准吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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