How to access ENUM from a DLL

  • Thread starter Thread starter vijay.gandhi
  • Start date Start date
V

vijay.gandhi

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.
 
Hi vijay!
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.

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.


--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
 
Hi,

I have a DLL (created in C++/CLI), that has a public enum.

For example:
namespace Utilities {
public enum DISTANCE_TYPE

You need "enum class" to get a .NET compatible enum.
 
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.
 
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.
 
Back
Top