Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / May 2007

Tip: Looking for answers? Try searching our database.

How to access ENUM from a DLL

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
vijay.gandhi@gmail.com - 30 May 2007 16:52 GMT
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.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.