469,931 Members | 2,640 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,931 developers. It's quick & easy.

Repost - weird behaviour with function declaration

Hello,

I posted this a few days back, but got no response, so I
am reposting it.

I have an event in my managed class which I declare as:

__event void MyEvent(System::Byte (*fir) __gc[]);

However, I find that when I build the class, I get very
strange errors like

error C2143: syntax error : missing ')' before ';'

I think the problem has to do with my declaration, because
when I redeclare the event as

__event void MyEvent(System::Byte fir __gc[]);

the error goes away. However, I don't feel satisfied with
this because I don't see a problem with the declaration.

In addition, this event is going to be consumed by a VB.NET
application and since the array it is passing as a parameter
is a managed array, I have to pass a pointer to the array
instead of the array itself as I do in the 'corrected'
version.

I would appreciate it if anyone could shed some more
light on the correct way to raise events that have arrays
as parameters. Should I just use System::Array* instead?

--
Akin

aknak at aksoto dot idps dot co dot uk
Nov 17 '05 #1
1 1135
"Wild Wind" <no****@blackhole.com> wrote in message news:<2j************@uni-berlin.de>...
Hello,

I posted this a few days back, but got no response, so I
am reposting it.

I have an event in my managed class which I declare as:

__event void MyEvent(System::Byte (*fir) __gc[]);

However, I find that when I build the class, I get very
strange errors like

......

Hi. I am not really sure what you are trying to do with your events.
But forgetting events for the moment, if what you intend is to declare
a pointer to an array, they your declaration is wrong.

try something like:

typedef System::Byte MyByteArray __gc[];

and then use it like __event void MyEvent(MyByteArray *array);

NB: I am just pointing you in the right direction as far as declaring
a pointer to your array goes... I have no clues what your VB client
expects or how you are implementing the event etc....

hth.
-Vinayak
Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Nils Emil P. Larsen | last post: by
reply views Thread by Wild Wind | last post: by
14 posts views Thread by Nak | last post: by
2 posts views Thread by Juha Nieminen | last post: by
11 posts views Thread by Pranav | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.