CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2006
    Posts
    6

    [RESOLVED] Boost and C++/CLI

    I find the Boost libraries very useful in native C++ code. Do you know if some or all of the libraries would work in managed code? Thanks.

  2. #2
    Join Date
    May 2006
    Posts
    22

    Re: Boost and C++/CLI

    I must admit that I haven't tried using Boost with C++/CLI though I have tried it with the containers from the C++ Standard Library. I believe that you should be able to do it. The one problem will be with reference types - you are going to have to use the gcroot class to wrap any instances of a reference type - this is necessary so that the GC can keep track of any "references" that are held by the Boost classes.
    Jonathan Caves
    Visual C++ Compiler Team

  3. #3
    Join Date
    Jun 2006
    Posts
    6

    Re: Boost and C++/CLI

    Is there any way to automate the gcroot wrappers? With brilliant compiler tricks or something like that? If Boost and other native code libraries could be used with confidence, it would make C++/CLI much more attractive to mainstream C++ programmers.

  4. #4
    Join Date
    May 2006
    Posts
    22

    Re: [RESOLVED] Boost and C++/CLI

    While in general it might be possible to do this the compiler would have to take a very pessimistic view and assume if a class template was specialized with a reference type then it should be replaced by the reference type wrapped in gcroot - this could cause problems in some cases.

    Much as I love C++ and this compiler I have learnt over the years that the less the compiler does behind the user's back the better.
    Jonathan Caves
    Visual C++ Compiler Team

  5. #5
    Join Date
    Jun 2006
    Posts
    6

    Re: [RESOLVED] Boost and C++/CLI

    I see what you mean about how compiler "automation" can go awry. How about an attribute or #pragma to specify that the enclosed code will be accessed by native code and needs to be wrapped.

    I just think it would be great if there was an easy, foolproof(?) way to interface to all the native code libraries out there, particularly Boost. Thanks for your comments.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured