Lei Jiang said:
If I have to add __gc in every class, it would be a huge work. Is there any
option that could compile all C++ class into manganged class without modify
any source code?
Nope, sorry. life is not that simple ;-)
Further, I do not think that just by adding a __gc you can "convert"
your classes into managed classes. THere are many conceptual
differences that you just have to handle. For example, code that
instantiates any of your class objects on the stack will fail under
the managed version (you always create managed class instances on the
heap) and so on....
Two choices:
1. write a managed wrapper for each of your class
2. If you think adding a __gc will solve your problem (maybe you have
analysed the problem and figured that all you need is a __gc), in
which case, you can try adding a preprocessor definition like
#define class public __gc class
although I can bet a 100 bucks that #2 will just not work.
hth.
-Vinayak