Events through interfaces in MVC++ : compiler error C3632 (undocumented) 
Author Message
 Events through interfaces in MVC++ : compiler error C3632 (undocumented)

Hi,
Does anybody know how I can define an event in an interface? This is
what I tried:
        __gc __interface ISrc
        {
                __event void MyEvent(int n);
        }
I got compiler error C3632 - Illegal style of event for interfaces.
There is no documentation that I could find on this error.
I'm sure this should be possible, because it's possible in C#. I tried
the following:
        public interface ISomething
        {
                event EventHandler myEvent;
        }
and it compiled. I inherited ISomething in a class, and I had to
define the event again in the class, which is exactly what I want.

Any idea anyone?
Thanks.



Mon, 16 Feb 2004 20:52:42 GMT  
 Events through interfaces in MVC++ : compiler error C3632 (undocumented)
Hi,

In current builds, the error is documented as follows:
'event': illegal style of event for interfaces

An __event cannot be declared in an interface.

The following sample generates C3632:

// C3632.cpp
// compile with: /clr
#using <mscorlib.dll>
using namespace System;

public __gc __interface I
{
   __event void sna();   // C3632

Quote:
};

// use the following as an example
__delegate void MyDel();
public __gc __interface I2
{
   __event MyDel* sna;

Quote:
};

int main()
{
Quote:
}

I a investigating whether there is another style of events you can implement
since the CLR definitely does allow events in interfaces.

Ronald Laeremans
Visual C++ compiler team


Quote:
> Hi,
> Does anybody know how I can define an event in an interface? This is
> what I tried:
> __gc __interface ISrc
> {
> __event void MyEvent(int n);
> }
> I got compiler error C3632 - Illegal style of event for interfaces.
> There is no documentation that I could find on this error.
> I'm sure this should be possible, because it's possible in C#. I tried
> the following:
> public interface ISomething
> {
> event EventHandler myEvent;
> }
> and it compiled. I inherited ISomething in a class, and I had to
> define the event again in the class, which is exactly what I want.

> Any idea anyone?
> Thanks.



Tue, 17 Feb 2004 02:46:48 GMT  
 Events through interfaces in MVC++ : compiler error C3632 (undocumented)
Hi,
Thank you for your answer. Please let me know what you find out.

Almog Shabtay


Quote:
> Hi,

> In current builds, the error is documented as follows:
> 'event': illegal style of event for interfaces

> An __event cannot be declared in an interface.

> The following sample generates C3632:

> // C3632.cpp
> // compile with: /clr
> #using <mscorlib.dll>
> using namespace System;

> public __gc __interface I
> {
>    __event void sna();   // C3632
> };

> // use the following as an example
> __delegate void MyDel();
> public __gc __interface I2
> {
>    __event MyDel* sna;
> };

> int main()
> {
> }
> I a investigating whether there is another style of events you can implement
> since the CLR definitely does allow events in interfaces.

> Ronald Laeremans
> Visual C++ compiler team



Thu, 19 Feb 2004 16:36:41 GMT  
 Events through interfaces in MVC++ : compiler error C3632 (undocumented)
Sorry for the delay. Does this help?

__delegate void foo();

__gc __interface I {

// event 1

__event foo* bar; // legal

// event 2

__event add_sna(foo*); // legal

__event remove_sna(foo*); // legal

// event 3

__event void fu(); // illegal

Quote:
};

The technical reason why "event 3" is illegal is -- that form of event
injects a delegate definition:

__delegate void __Delegate_fu();

into the current scope.


Quote:
> Hi,
> Thank you for your answer. Please let me know what you find out.

> Almog Shabtay




Quote:
> > Hi,

> > In current builds, the error is documented as follows:
> > 'event': illegal style of event for interfaces

> > An __event cannot be declared in an interface.

> > The following sample generates C3632:

> > // C3632.cpp
> > // compile with: /clr
> > #using <mscorlib.dll>
> > using namespace System;

> > public __gc __interface I
> > {
> >    __event void sna();   // C3632
> > };

> > // use the following as an example
> > __delegate void MyDel();
> > public __gc __interface I2
> > {
> >    __event MyDel* sna;
> > };

> > int main()
> > {
> > }
> > I a investigating whether there is another style of events you can
implement
> > since the CLR definitely does allow events in interfaces.

> > Ronald Laeremans
> > Visual C++ compiler team



Thu, 04 Mar 2004 06:45:24 GMT  
 Events through interfaces in MVC++ : compiler error C3632 (undocumented)
Thank you for your help.


Quote:
> Sorry for the delay. Does this help?

> __delegate void foo();

> __gc __interface I {

> // event 1

> __event foo* bar; // legal

> // event 2

> __event add_sna(foo*); // legal

> __event remove_sna(foo*); // legal

> // event 3

> __event void fu(); // illegal

> };

> The technical reason why "event 3" is illegal is -- that form of event
> injects a delegate definition:

> __delegate void __Delegate_fu();

> into the current scope.



Mon, 08 Mar 2004 14:19:39 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. FS: MVC++ 1.0 and MVC++ 2.0

2. New Undocumented ATL Interface: ICollectionOnSTL

3. Undocumented Interface IRemoteComputer

4. Internal Compiler Error while deriving C# class from a MC++ class implementing a C# interface

5. Compiler error for Events in Managed C++

6. Compiler bug or undocumented class?

7. MVC++ error message

8. Undocumented ADO error codes

9. VC++6.0/SP3 Compiler Error: INTERNAL COMPILER ERROR

10. Undocumented Error in BC++3.1

11. NetUserChangePassword() undocumented error?

12. Undocumented error code

 

 
Powered by phpBB® Forum Software