P
Peter Oliphant
At one point I started a thread about how hard it is to convert 2003 Managed
C++ code to 2005 /clr C++ code, and said it was too hard. Well, now that
I've been doing it for a while, it isn't really that bad. You have to know a
few rules, and then just allow the compiler to tell you what's wrong.
I run the compiler, and then look at first error it reports. Correct, rinse,
lather, repeat. Usually errors can be corrected in one of the following
ways:
(*) change '*' to '^'
(*) change '__gc' to 'ref'
(*) remove __ from directives (e.g., __delegate => delegate)
(*) change new to gcnew
Arrays are the 'hard' one. change things of the form:
myClass my_class_array[] ;
my_class_array = new myClass[count];
to:
array<myClass>^ my_class_array ;
my_class_array = gcnew array<myClass>(count) ;
There are other changes, but these will get you through most conversions...
[==P==]
C++ code to 2005 /clr C++ code, and said it was too hard. Well, now that
I've been doing it for a while, it isn't really that bad. You have to know a
few rules, and then just allow the compiler to tell you what's wrong.
I run the compiler, and then look at first error it reports. Correct, rinse,
lather, repeat. Usually errors can be corrected in one of the following
ways:
(*) change '*' to '^'
(*) change '__gc' to 'ref'
(*) remove __ from directives (e.g., __delegate => delegate)
(*) change new to gcnew
Arrays are the 'hard' one. change things of the form:
myClass my_class_array[] ;
my_class_array = new myClass[count];
to:
array<myClass>^ my_class_array ;
my_class_array = gcnew array<myClass>(count) ;
There are other changes, but these will get you through most conversions...
[==P==]