开发者

Can Silverlight be linked with a C++ static library?

I'm currently doing researches to start a new project. This project will be in 2 parts a light Client (probably console) and an heavy one using silverlight. The light client must be cross-platform.

However, they will both use the same Core (by the way, the core will need to use the sockets).

I'd like to use C++ to build the light client but given that the core is common to both applications, it would be much appreciated if it's could be the same code.

So the question is quite simple : Can Silverlight be compilated with a C++ static library ? And if it's possible, what about cross-platform issues (wit开发者_如何学Pythonh moonlight) ?

If it's not possible. Which language can i use to work with silverlight while being cross-platform ? Because of performance, a compilated language will be better !

Thanks for your expertise :)


No.

Not only is Silverlight only managed code, it does not use the standard CRL, but a special CRL known as the CoreCLR. Silverlight assemblies are real .Net assemblies, but are compiled against a limited subset of the core .Net libraries. When running in the CoreCLR (in your browser) Silverlight assemblies are restricted in several ways for security reasons. You cannot even write Silverlight assemblies with C++, and no Silverlight code can be marked unsafe (I admit there might be a hack way around this limitation out there).

This answer only applies to Silverlight 2 & 3, and while I don't have a lot of experience with Silverlight 4 I am not aware of anything that gives you this capability cross-browser with SL4.

I think you are going to be disappointed if you are counting on Moonlight for Linux compatibility. My team chose Silverlight since it runs on Firefox, IE, and soon Chrome and unofficially Opera on Windows, and Firefox and Safari on Mac.

Edit: Note author date of this post, this is pre-SL4.


No. Silverlight is managed code only.

However, Silverlight 4 will support COM interop, when run with elevated permissions out of browser. This will not work on other platforms - it is a Windows only feature. Justin Angel mentioned this in his blog post regarding the (not quite) cross-platform of Silverlight.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜