Is it possible to share an enum declaration between C# and unmanaged C++?
Is there a way to share an enum definition between native (unmanaged) C++ and (managed) C#? I have the following enum used in completely unmanaged code: enum MyEnum { myVal1, myVal2 }; Our application sometimes uses a managed component. That C# component gets the enum item values as ints via a managed C++ interop dll (from the native dll). (The interop dll only loads if the C# component is needed.) The C# component has duplicated the enum definition: public enum MyEnum { myVal1, myVal2 }; Is there a way to eliminate the duplication without turning the native C++ dll into a managed dll? You can