DevLabs: C++, Cloud Services, and You


I’m excited today to announce a new DevLabs project: Microsoft Codename “Casablanca”.  You can learn more about the project and download the bits from the DevLabs site.

I’ve previously discussed some of the major trends that have influenced the direction we’ve taken for developer tools, with a key example being applications that connect devices to continuous services running in the cloud.  In order to develop such applications efficiently, developers need productive, high-level programming models and APIs for connecting to and interacting with services.  Similarly, in order to build those services in a scalable manner, developers need productive models that compose well and that are fundamentally asynchronous.

Take .NET as an example.  C#, Visual Basic, and F# developers all have a robust and scalable networking stack, which has been made all the more productive with .NET 4.5 advances such as HttpClient, language support for asynchrony, and an ASP.NET Web API framework for easily building HTTP services.  Or take Node.js, which, with the Windows Azure SDK, enables you to easily build fast and scalable network applications for the cloud using JavaScript.

Historically, we’ve lacked such simple tools for developers using C++.  While there are multiple relevant native networking APIs (e.g. WinINet, WinHTTP, IXMLHttpRequest2, HTTP Server API), these are not optimized from a productivity perspective for consuming and implementing RESTful cloud services using modern C++.  They don’t compose particularly well with code based on the standard C++ libraries, and they don’t take advantage of modern C++ language features and practices in their programming models.

This is where “Casablanca” comes in.  “Casablanca” is a set of libraries for C++ developers, taking advantage of some recent standard language features already available through Visual Studio.

“Casablanca” aims to make it significantly easier for C++ coders to consume and implement RESTful services.  It builds on lessons from .NET, from Node.js, from Erlang, and from other influencers to create a modern model that is meant to be easy to program while still being scalable, composable, and flexible.

As an example, here’s a snippet that uses the client HTTP library to search Bing for my name and output the results to the console:

http_client bing(L”http://www.bing.com/search”);
bing.request(methods::GET, L”?q=S.Somasegar”).then([](http_response response) {
    cout << “HTML SOURCE:” << endl << response.to_string() << endl;
}).wait();

and here’s a simple web listener hosted in a console application:

using namespace http;

int __cdecl wmain(int argc, wchar_t * argv[]) {
    listener::create(argv[1], [](http_request req) {
        req.reply(status_codes::OK, “Namaste!”);
    }).listen([](){ fgetc(stdin); }).wait();
}

For those of you looking to build Azure services in C++, “Casablanca” comes with a Visual Studio wizard to set up everything up correctly.  You can target both Web and Worker roles, and you can access Azure storage using the built-in C++ library bindings.

Last week, I blogged about some of our efforts to “meet developers where they are.”  Our work around C++ has long been a significant component of that, with so much software in the world developed in the language and with its heavy cross-platform adoption.  Taking C++ to the cloud with “Casablanca” is another exciting step in that journey.

As with other DevLabs releases, this release of “Casablanca” is meant for you to experiment with and to provide feedback on.  We would love to know whether you’re interested in using C++ to consume and implement cloud services, and if so, what kind of support you want in order to do so, whether “Casablanca” is on the right track, and how you’d like to see it evolve.  We look forward to hearing from you in the forums.

Namaste!

Comments (34)

  1. John Azariah says:

    Awesome news! Look forward to using this!

  2. Stephen says:

    Please! Please! Please!  Announce (one way or the other) if .Net 4.5 will support Windows XP.  (Of course I want to hear that it will be supported.  But I NEED to know one way or the other…)

  3. Fendi says:

    I apologize for being off-topic, but, like Stephen, I would greatly appreciate information on the decisions made about XP targeting support in VS11. For C++ developers like me, using VS11 with the VS2010 toolchain is not particularly interesting as the main feature of VS11 is the improved C++11 compliance provided by the VS11 toolchain.

  4. Stephen says:

    I have to wonder why you will not say what your XP support plans are.  I find it hard to believe that you don't know what you are working towards (with the release as close as it is).

    If you do know, why not say?  That let's us make plans and prepare (which ever way you have chosen to go).  Being in the dark just messes us up and frustrates us.

    We hear so much about Microsoft trying to be transparent, but then this kind non-information happens….

    Please, just tell us what the plan is so that we can plan too.  

    (Note: Everyone knows that plans can change.  Feel free to put all kinds of "Beta Disclaimers" on it.  Just let us know which way you are leaning.)

  5. Petteri says:

    What happened to "DEVELOPERS DEVELOPERS DEVELOPERS"? The response from Microsoft on this matter (XP targeting support in VS11), or the lack thereof, has been very disappointing so far.

    I repeat what many of my peers have already said: we want improved C++11 compliance and XP targeting support. Using the VS2010 toolchain together with the VS11 UI is far from a solution.

  6. bobobobo says:

    Can you explain this line: int __cdecl wmain? It doesn't look like C++ to me.

    Also I would buy MSVC++11 but I need to target WinXP.

  7. David says:

    Sorry for the off-topic, but I have to say that while the above code looks interesting, I also will not be able to use it if VS11 doesn't support XP, as is currently planned.

    Seriously, dropping support for XP is so huge that, well, it ruins everything. If VS11 can't support XP, we simply can't use it, end of story. Neither cloud services, nor anything else born in DevLabs will change it.

    I hope the decision to drop support for XP is reconsidered. I also hope you tell us whether or not you are indeed going to drop support for XP in VS11 soon. We've been said over at vcblog that we will hopefully get some more info on that in several weeks, well, one week has already passed since then.

    Sad and disappointed, but hopeful.

  8. toub says:

    Stephen, Fendi, Petteri, and David: Thank you for the feedback on XP; I assure you the XP feedback has been heard (and it's not necessary to double-post the feedback on the VC blog and here; we see it wherever it's shared).  Steve Teixeira, Director of Program Management for the Visual C++ team, has stated on the post at blogs.msdn.com/…/10295093.aspx: "Based on all of the feedback offered on this thread as well as in places like UserVoice and Channel9, it's clear that a large number of VC++ customers would really like to see Dev11 support XP targeting. I deeply appreciate the opportunity for this conversation and the feedback. The ball is now in our court, and we will follow up on this issue in the coming weeks to talk about our plan for Dev11 RTM."

  9. Niklas Gustafsson says:

    Regarding "__cdecl": it's a Microsoft C++ calling convention keyword.

    It's strictly speaking optional here, because __cdecl is normally the default, but many of us at Microsoft have a habit of being explicit about calling conventions in code that is used outside the user code, in this case the main function being called from the runtime.

    If you want to go any deeper than that, here's an MSDN article on Microsoft C/C++ calling conventions:

    msdn.microsoft.com/…/k2b2ssfy(v=vs.100).aspx

  10. Fendi says:

    @Stephen Toub: What is "coming weeks"? 3 weeks? 3 months? Never?

  11. toub says:

    Fendi: I can't speak to the exact timeframe, but I can assure you it'll be sooner than "Never," and Steve Teixeira stated "weeks" rather than "months."  Thanks, again, for your interest.

  12. Chris says:

    I really hope the VC++ team actually meant that they'll consider XP support. They could very well be faking this "intense several week discussion" to silence us a bit.

  13. GregM says:

    "Thank you for the feedback on XP; I assure you the XP feedback has been heard (and it's not necessary to double-post the feedback on the VC blog and here; we see it wherever it's shared)."

    Forgive us if we're a bit skeptical.  We've been giving you this feedback since last summer, and it's taken until now for someone to take us seriously.  It was 7 months from when the initial connect incident was closed as "By Design", to when we finally got an acknowledgement that the VC++ team was actually listening and reconsidering the decision.  This has shown that it takes a large volume of feedback for it to be noticed, so it's understandable if we want to keep up the pressure and make absolutely sure it's seen.

  14. Stephen says:

    @Stephen Toub – Can you comment to the reason why you cannot give updates on the XP decision?  (IE are you still doing ROI or feasibility studies on it and don't want to share those?)

    ALSO: Is the Windows XP fate of .net 4.5 expected as part of the pending announcement that Steve Teixeira referenced?

  15. As Stephen Toub said, the team is continuing to work through the matter of XP targeting for C++ in Dev11, and we will be able to make a definitive statement about this in a few weeks. Please stay tuned, and I appreciate your patience!

  16. Stephen says:

    @Steve Teixeira – Any idea how I can get the this kind of Windows XP info (or really promise of info) from the .net 4.5 side of things?

  17. petke says:

    Sounds good. What I most lacking is a modern C++ soap library. gSoap, axis2,  hurts your eyes and are a pain when multithreading.

  18. weishng says:

    This is one of the best update for C++ web dev that we have been waiting for. Thanks for the great work!

  19. grumpy says:

    Meet devs where they are?

    So when virtually every C++ developer wants *two* things: XP support and C++11 support, and you're taking one away, and improving the other at a snail's pace, how exactly are we supposed to make sense of that?

    You're laughing at devs where they are, perhaps. Certainly not *meeting* them.

  20. Johnny Cunningham says:

    Wonderfull vision!!

  21. renaud says:

    XP support first please.

  22. Dont Believe says:

    Of course Microsoft won't support XP. This is a tactic to get corporations to upgrade to windows 7. Microsoft did the same thing with VB and Foxpro to move developers into Visual Notepad and their .NET OS layer. Microsoft hasn't released a good product since XP and Visual Studio 6.0, I believe they have forgotten how. What screams desperation is Microsoft newest innovation trying to copy the open source community by implementing MVC and embracing jquery.

    here is a tip build better software and people will be happy to migrate, your competition is doing it and it works.

  23. I would like XP support as well.  Here is my comment from the "Target Windows XP …" blog:

    "I would like to add myself to the list of C++ developers who want XP support continued in the VC++ 2011 compiler and in later compiler versions.  I won't be able to upgrade my compiler from VC++ 2010 so long as XP support is not there (at least not for real work on the job) due to the large user base for XP.  I really would like to be able to use the new modern C++11 features as they become available."

    Thank you for providing this format where we can express our needs.

  24. Marcello F. says:

    To what I will add that these kind of toolkits (jQuery, Node, et.al.) are getting excessive attention ultimately. The question that somebody will ask is if it runs or supports Windows XP?

    Regarding the XP controversy in vNext targeting, if all those customers would be running legal copies of Windows XP, would that be an issue as it is now?

  25. Narasimharao says:

    Sir i havea doubt any data type difference between 2006 visual studio and 2010 studio my results are coming differentwhen iuam running diferently i 2006 and 2010.please tell fast..

  26. sitapati says:

    mr.bill gates, why don't u make ur american ppl, rich.

  27. toub says:

    Narasimharao, can you elaborate on what problem you're experiencing?  If you're experiencing a problem with Visual C++, the forums at social.msdn.microsoft.com/…/visualc are a good place to discuss and ask your questions.

  28. Ramanathan says:

    Very fantastic

  29. I used to study C++ before, but now I forget. Wish to learn more.

  30. Sharavan says:

    Nice article ? Do you have a Linux version available for Download.

  31. Hi Sharavan,

    We recently released the C++ REST SDK ("Casablanca") as an open source project on CodePlex. To answer your question, yes we do support Linux. Please visit the project at http://casablanca.codeplex.com. Here you will be able to find more information about the SDK as well as instructions on how to download and build the sources for Linux. Please let us know in the discussion board on CodePlex if you have any issues or questions. Thanks!

  32. Sony says:

    I'm using C++ -casablanca, how to ignore certificate errors? or use a self signed certificate?

  33. Excellent news … C++ always was an easy fit for server side work but nobody wants to share. Thus PHP, Rails, Node.js all came about …