Boost logo

Boost Users :

Subject: Re: [Boost-users] c++/cli & file.h
From: Leon Mlakar (leon_at_[hidden])
Date: 2014-12-08 07:39:59


On 08.12.2014 13:28, Michael Powell wrote:
> On Mon, Dec 8, 2014 at 4:34 AM, It neophyte <phdlux85_at_[hidden]> wrote:
>> hi
>>
>> I was told, no by someone, but need further feedback to be sure.
> Where did they get their information from?
>
>> quick question: could boost headers (.h) be complied in c++/cli project?
> I would say in a couple of words: 1) it depends, and, 2) try it.
>
> The thing you have to remember about C++/CLI is that it is a C++
> language extension extending C++ into the .NET environment.
>
> With that in mind, it can seem very schizophrenic at times; it's C++,
> no it's .NET, it's C++, it's .NET, etc, etc. What do I mean by that?
>
> * You can make the same C++ includes that you would in any other C++ program
> * However, you are actually describing, for example, *.NET classes*
> (or other constructs) via C++
You can actually do both - describe objects that are the same as they
would be when compiled natively with C++ (unmanaged objects) and .NET
(managed) objects. And you use C++ language syntax (albeit extended) to
do that,
> * As such you can make the same sort of .NET references, using
> clauses, etc, as you would in a C# program, for instance, if memory
> serves
>
> That being said, I was successful in extending Boost.Units into a .NET
> Quantity based simulation. GC was an issue, but otherwise, things
> worked pretty well.
>
> Boost.Units is header only, and I haven't tried for other libraries.
> You might have some issues if you needed collections, you probably
> want to shy away from smart pointers, except under the hood, things of
> this nature.
>
> Check the MSDN for the precise verbiage. There are plenty of blogs and
> other resources.

It would depend on the boost library. C++/CLI in the current incarnation
(well, VS2013, don't know about 2014) does have some limitations, and
some C++11 standard libraries cannot be used. std::thread and friends
among them. I don't know whether that would extend to boost::thread.
Smart pointers shouldn't be a problem as long as they are used in the
code belonging to unmanaged objects.

So the only way to really tell is to try those you need.

Leon


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net