I h开发者_如何学Pythonave some C++ libraries. Is there a way to use them from Silverlight in a cross platform way (on Linux/Mac/PC)? I don't want to use C++/CLI if possible.
I googled this article saying COM is the only way. However, I was told that Silverlight4 supports PInvoke.
Silverlight 4 does not support PInvoke so the answer is no you can't directly use your C++ Libraries.
PInvoke is currently expected to be in Silverlight 5 for release sometime this year (2011).
See this John Papa blog Silverlight 5 Features, bullet point on OOB features.
My impression was that Silverlight on desktop doesn't support native C++. Here is a link that seem to confirm it: http://cristianadam.blogspot.com/2009/10/silverlight-for-windows-embeddedhh-c.html
This is not possible. Check out also this question.
Seams like most of the answeres only focus on the part of the question of wether Silverlight can run C++ code, however none of the questions appears to address the part of the question of Silverlight/C++ being cross platform -- to the best of my experiance Silverlight runs badly on Linux, so interpreting and summerizing from the other questions then;
- No, is does not work with C++, and
- No, nor does anything in Silverlight appears to work cross platform/browser.
Update: Just installed the latest version of Moonlight (Silverlight for Linux), and now at least it works, but it is using 100% of my CPU when active, so probably still not a good choice for a cross platform application. (using Chrome on 64Bit Linux)
精彩评论