Search:
Namespaces
Discussions
.NET v1.1
Feedback
MC++ wrapper code problems with return enum type.
Messages
Related Types
This message was discovered on
microsoft.public.dotnet.languages.vc
.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...
tzvika.visman@nospammsys.com
I write a MC++ wrapper for our company internal SDK that wrote in C++ native
code for writing application with this SDK over C# and other .NET languages
and most of my SDK API function return a status code that define as a enum
type.
Do I have other option then duplicate the enum from the c++ to the C# code
and write a MC++ class that look something like this:
public __gc class ManagedDokStatus
{
public:
ManagedDokStatus(DOK_STATUS statusCode):m_statusCode (statusCode ){}
__property int get_Status()
{
return static_cast<int> (m_statusCode);
}
private:
DOK_STATUS m_statusCode;
};
The DOK_STATUS type is the native c++ enum and from the C# code I done
something like this:
Declare the following enum:
enum C#DokStatus
{
// define the same c++ native enum attributes
};
And using the API like this:
return (C#DokStatus)(dok.getSerialNumber (ref serialNumber)).Status;
---
Posted using Wimdows.net NntpNews Component -
Post Made from
http://www.DotNetJunkies.com/newsgroups
Our newsgroup engine supports Post Alerts, Ratings, and Searching.
Reply to this message...
charlee strong (VIP)
hi,
I assume you need to redefine the macros in your Managed wrapper.
That's what i'm doing in my project, I would like to get second openion:
for example, in my legacy unmanaged SDK, i have a class :
namespace UnManaged{
class Foo
{
enum MyEnum{ MODE1=0, MODE2 };
...
}
}
the wrapper will be:
class ManagedFoo
{
// Now i have a two ways to redefine
// Method : 1 Native enum - but which is not visible from C#
public:
enum MyEnum{ MODE1=0, MODE2 };
or
enum class MyEnum{ MODE1=0, MODE2}; // CLI enum - which is visible from C#
}
Is there a 3rd way by using typedef to redefine Unmaged enum in managed class?
"
Click here to reveal e-mail address
" wrote:
[Original message clipped]
Reply to this message...
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com