I am considering porting a C / C ++ application to the C ++ + CLI.
Basically, I would like to use the reflection potential, XML serialization, and generally all the features of the .NET Framework offered by Microsoft (possibly even in mono).
In this project, STL is not used heavily, and application objects are mainly distributed statically. A lot of code is written in C, the other is implemented in C ++.
The problem is that the code is very, very, very "long": this is the problem for the time it takes to convert the existing code so that it works correctly.
I tried to create a C ++ project compiled with the flag in / clr, after all, it was not so bad. you can save the existing C ++ code, but in the meantime use the “managed” classes, even access the “managed” objects from the methods of the C ++ class.
The shortcomings that I found are very few, but make me puzzled by this "migration" ...
To use data serialization with reflection, all my data structures must be managed. An unmanaged class cannot declare fields defined by the type of the managed class. To solve this problem, if the class is transformed so that it is controlled by the garbage collector, each class that also declares a member of this type.
What difficulties might arise when introducing managed classes?
Well, I'm thinking about:
- String management (I don't like to call AllocaHGlobal to convert System.String to char * every time I need it (for example, as a function parameter)
- Array management (converting classic arrays to cli :: array)
- (already mentioned) a mixture of managed and unmanaged classes
- Exception Handling
- Creating a backup of a crash (core), how it affected
- ... any other that I have not thought of ...