473,382 Members | 1,180 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Moving interface & enum from IDL to C++/CLI

I am working on a project that currently has some interfaces and enums
defined in an IDL file. The sole implementor of these interfaces are
now in C++ CLI, but I still have consumers that are in unmanaged C++.
I would like to move the interface and enum definitions to the C++ CLI
code, but I cannot figure out what shape it should take:

typedef [ uuid(4E803D49-2EB8-450a-BD00-DC8336D1E6B5) ]
enum {
associate,
chief,
boss
} MemberTypeEnum;

[
object,
uuid(F1A27469-9E22-41dd-A905-F76C7DB0BE51),
dual,
nonextensible,
pointer_default(unique)
]
interface IMember : IDispatch {
[id(1), propget] HRESULT Name([out, retval] BSTR* pRetVal);
[id(2), propget] HRESULT Address([out, retval] BSTR* pRetVal);
[id(3), propget] HRESULT Phone([out, retval] BSTR* pRetVal);
[id(4), propget] HRESULT Joined([out, retval] DATE* pRetVal);
[id(5), propget] HRESULT MemberType([out, retval] MemberTypeEnum*
pRetVal);
};

to

typedef [ uuid(4E803D49-2EB8-450a-BD00-DC8336D1E6B5) ]
enum MemberTypeEnum {
associate,
chief,
boss
};

[uuid("F1A27469-9E22-41dd-A905-F76C7DB0BE51")]
public interface class IMember
{
property String^ Name { get(); };
property String^ Address { get(); };
property String^ Phone { get(); };
property DateTime Joined{ get(); };
property MemberTypeEnum MemberType();
};

Aug 12 '07 #1
1 3753
you can create a type library

--
Sheng Jiang
Microsoft MVP in VC++
"Cartoper" <ca******@gmail.comwrote in message
news:11**********************@q4g2000prc.googlegro ups.com...
I am working on a project that currently has some interfaces and enums
defined in an IDL file. The sole implementor of these interfaces are
now in C++ CLI, but I still have consumers that are in unmanaged C++.
I would like to move the interface and enum definitions to the C++ CLI
code, but I cannot figure out what shape it should take:

typedef [ uuid(4E803D49-2EB8-450a-BD00-DC8336D1E6B5) ]
enum {
associate,
chief,
boss
} MemberTypeEnum;

[
object,
uuid(F1A27469-9E22-41dd-A905-F76C7DB0BE51),
dual,
nonextensible,
pointer_default(unique)
]
interface IMember : IDispatch {
[id(1), propget] HRESULT Name([out, retval] BSTR* pRetVal);
[id(2), propget] HRESULT Address([out, retval] BSTR* pRetVal);
[id(3), propget] HRESULT Phone([out, retval] BSTR* pRetVal);
[id(4), propget] HRESULT Joined([out, retval] DATE* pRetVal);
[id(5), propget] HRESULT MemberType([out, retval] MemberTypeEnum*
pRetVal);
};

to

typedef [ uuid(4E803D49-2EB8-450a-BD00-DC8336D1E6B5) ]
enum MemberTypeEnum {
associate,
chief,
boss
};

[uuid("F1A27469-9E22-41dd-A905-F76C7DB0BE51")]
public interface class IMember
{
property String^ Name { get(); };
property String^ Address { get(); };
property String^ Phone { get(); };
property DateTime Joined{ get(); };
property MemberTypeEnum MemberType();
};

Aug 13 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: SpaceCowboy | last post by:
I recently got into a discussion with a co-worker about using enums across a dll interface. He wanted to use chars instead, argueing that depending on compiler settings the size of an enum could...
1
by: Torben Madsen | last post by:
I need a intereface so that i get the same structure in several arrays that i create. I think that i need to use enum in a interface. Abstract classes don't do the job as i need to inherit from...
2
by: David | last post by:
hello... how can i use IActiveDesktop COM interface from shell32.dll? thanx...
2
by: matthew_glen_evans | last post by:
Hi there, Quick one about interfaces in c#. It seems that it is illegal to declare types within an interface. I was quite used to doing this in VB.net where the interface can define a...
0
by: Robin Tucker | last post by:
I need to create my own explorer-style control - I don't seem to have access to IShellFolder - assuming I need it (which I think I do), how can this be done? I've imported shell32.dll into my...
2
by: Cristiano de Pádua Milagres Oliveira | last post by:
What do I to declare the header of a Property in an Interface, and should this property return a generic Enum? Example: public interface IMetric { Enum Unit { get;} } public class...
3
by: Andrew Bainbridge | last post by:
Hi, I'm converting some code over from vb.net to c# and have the following issue. In VB you can have enum's within an interface. i.e. Public Interface Class1 Enum ColorType Black Red
13
by: Bob | last post by:
Hi, Can someone explain why you can't declare enums in an interface? The compiler says "interfaces can't declare types" Ignoring the syntax implications it seems to me that you should be able to...
0
by: habakkuk | last post by:
Hi, I gotten Protected Memory Error while trying to access the C++ interface from C#, I am wandering is it something is not correct on my interpretation from C++ to C#. Below is the C++ Interface...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.