porting legacy C++ enums to managed object?

B

Bae,Hyun-jik

Is there any way to port legacy C++ enum to managed object?
For example, let's assume there is a C++ header file(we cannot modify it,
because it is updated by other vendor). It has a enum definition like this.

enum AAA { a,b,c };

Assuming that we made a managed DLL whose namespace id MyLib. I tried
several way such as

typedef __gc AAA MyAAA;

and it generates just syntax errors.

Please reply. Thanks in advance.

Regards,
Hyun-jik Bae
 
T

Tamas Demjen

I believe you have to create an independent managed enum, which
duplicates its unmanaged counterpart, and helper functions that convert
back and forth between them, using a switch, or maybe a bunch of ifs.
It's a part of the wrapping work. I'm not sure if there are tools that
auto generate managed code that wraps unmanaged enums, structs and
classes. Often it couldn't be 100% automated anyway.

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top