views:

75

answers:

2

Hi,

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 (with 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 :)

+1  A: 

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.

Reed Copsey
There is ways to "force" cohabitation beetween managed C# and not managed C++ ! But thanks for the blog post i will look into it :)
Niklaos
+2  A: 

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.

Jason Jackson