A
ajtaylor
Hello,
I am hoping someone can clear up some confusion I have as seemingly
(like all things C++/CLI it seems) there isn't too much information
out there.
I have a load of unmanaged C++ that has been built up over the years
and performs well. I have some C++/CLI code that uses this unmanaged
code seemingly quite well (although I do worry that the performance is
not as good as it should be due to my lack of knowledge)
The unmanaged C++ code uses a lot of BOOST stuff and this raises other
issues (more on that later).
The setup I have is the unmanaged code is in a series of .LIBs. I then
have a /CLR compiled project that links against these libs. I mainly
have classes in the /CLR project that creates a managed wrapper for
the unmanaged code. Then I have some ASP.NET code that uses this
assembly.
The questions I have on this setup are:-
(1) Should I be wrapping #included UNMANAGED headers with #pragma
unmanaged, #pragma managed block? (I currently do - but read on MSDN
and on this newsgroup that this is a no-no)
The reason I ask is I cant get my head around what the compiler will
do when it encounters one of my unmanaged headers in a file compiled
with /CLR. I am particularly concerned as I use things like
boost::shared_ptr in my unmanaged code. Does the /CLR option cause the
compiler to try to convert the included stuff into C++/CLI compatible
code?
One of my reasons for doing this was that I was getting no end of
grief trying to use BOOST 1_34_1 and this thread (see at the bottom)
http://www.thescripts.com/forum/thread701525.html
Suggested this approach.
(2) If say I have a std::vector containing a load of pointers (well
boost::shared_ptrs) is there any harm in passing this around C++/CLI
Managed code?
What I wonder is if I am providing a wrapper class for the unmanaged
code am I expected to extract all the data from the std::vector and
put it into managed structures? So that the #includes for unmanaged
code is only in one cpp file (say)?
Many thanks for your time.
A.
I am hoping someone can clear up some confusion I have as seemingly
(like all things C++/CLI it seems) there isn't too much information
out there.
I have a load of unmanaged C++ that has been built up over the years
and performs well. I have some C++/CLI code that uses this unmanaged
code seemingly quite well (although I do worry that the performance is
not as good as it should be due to my lack of knowledge)
The unmanaged C++ code uses a lot of BOOST stuff and this raises other
issues (more on that later).
The setup I have is the unmanaged code is in a series of .LIBs. I then
have a /CLR compiled project that links against these libs. I mainly
have classes in the /CLR project that creates a managed wrapper for
the unmanaged code. Then I have some ASP.NET code that uses this
assembly.
The questions I have on this setup are:-
(1) Should I be wrapping #included UNMANAGED headers with #pragma
unmanaged, #pragma managed block? (I currently do - but read on MSDN
and on this newsgroup that this is a no-no)
The reason I ask is I cant get my head around what the compiler will
do when it encounters one of my unmanaged headers in a file compiled
with /CLR. I am particularly concerned as I use things like
boost::shared_ptr in my unmanaged code. Does the /CLR option cause the
compiler to try to convert the included stuff into C++/CLI compatible
code?
One of my reasons for doing this was that I was getting no end of
grief trying to use BOOST 1_34_1 and this thread (see at the bottom)
http://www.thescripts.com/forum/thread701525.html
Suggested this approach.
(2) If say I have a std::vector containing a load of pointers (well
boost::shared_ptrs) is there any harm in passing this around C++/CLI
Managed code?
What I wonder is if I am providing a wrapper class for the unmanaged
code am I expected to extract all the data from the std::vector and
put it into managed structures? So that the #includes for unmanaged
code is only in one cpp file (say)?
Many thanks for your time.
A.