Hi,
I have a DLL (created in C++/CLI), that has a public enum.
For example:
namespace Utilities {
public enum DISTANCE_TYPE
{
a,
b,
c
};
}
This DLL was imported to another C++/CLI project. While I can see the
DISTANCE_TYPE in the 'object browser', I am not able to access it ( I
use: 'DISTANCE_TYPE nDisType;' in my code). The Visual Studio
editor's Intellisense does not list DISTANCE_TYPE as a member of
Utilities, and even the compiler throws an error that DISTANCE_TYPE is
undeclared. However, when I redeclare it in my new project, the
compiler throws an error that the type DISTANCE_TYPE is redefined.
Is there any other way to use the enum's in the DLL?
Thank you very much,
Vijay.
Jochen Kalmbach [MVP] - 30 May 2007 16:57 GMT
Hi vijay!
> I have a DLL (created in C++/CLI), that has a public enum.
>
[quoted text clipped - 9 lines]
>
> This DLL was imported to another C++/CLI project.
What do you mean with "imported"?
You need to "add a reference" to this DLL-Assembly. That's all; then you
can use all public symbols.

Signature
Greetings
Jochen
My blog about Win32 and .NET
http://blog.kalmbachnet.de/
Ben Voigt [C++ MVP] - 30 May 2007 19:25 GMT
> Hi,
>
[quoted text clipped - 3 lines]
> namespace Utilities {
> public enum DISTANCE_TYPE
You need "enum class" to get a .NET compatible enum.
> {
> a,
[quoted text clipped - 15 lines]
> Thank you very much,
> Vijay.
vijay.gandhi@gmail.com - 30 May 2007 20:00 GMT
Jochen, thanks for your reply. Yes, by imported I meant adding a
reference. It still doesn't show up.
Ben, thank you. Just read about 'enum class.'
Vijay.
Ben Voigt [C++ MVP] - 30 May 2007 21:57 GMT
> Jochen, thanks for your reply. Yes, by imported I meant adding a
> reference. It still doesn't show up.
>
> Ben, thank you. Just read about 'enum class.'
Glad to be helpful.
> Vijay.