473,394 Members | 1,840 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,394 software developers and data experts.

how to implement interface with argument "int (__gc*) __gc[]"

I have a C# interface as:
public interface IBar{
void TestParam(ref StringCollection a, ref int [] b);
}

And I need to implment it in Managed C++, and I try to implement it as:

public __gc class Foo : public IBar
{
public:
virtual void ITestParam::TestParam(StringCollection __gc* __gc* a,
int (__gc*) b __gc[])
{
}
}

The complier complains that:
error C2146: syntax error : missing ')' before identifier 'b'.

I try a lot of different options, putting b in different position, and
just could not get it right. Any idea?

I realize that the problem is with the second parameter "ref int [] b"
cos if I took it out it just works.

Nov 17 '05 #1
5 1552
Got a cut and paste error, I mean:

virtual void IBar::TestParam(StringCollection __gc* __gc* a,
int (__gc*) b __gc[])

but not:

virtual void ITestParam::TestParam(StringCollection __gc* __gc* a,
int (__gc*) b __gc[])
Thanks for any suggestion.

Nov 17 '05 #2
> virtual void IBar::TestParam(StringCollection __gc* __gc* a,
int (__gc*) b __gc[])

use:

void TestParam(StringCollection ** a , int (*b) __gc[] ){}

for further details refer to:

http://msdn.microsoft.com/library/de...dquestions.asp

Greets, Sebastian Dau
Nov 17 '05 #3
Thanks.
Yes, using your prototype seems to compile. But when I use the object
browser to look up the interface function TestParams, it indeed shows
as:

TestParams(StringCollection __gc* __gc*, int (__gc*) __gc[]);

That's how I tried to implment it as such. Anyway, without the 3 __gc
qualifier seems to make it compile, but does it mean that they are not
gc pointers?

Nov 17 '05 #4
Hi,
TestParams(StringCollection __gc* __gc*, int (__gc*) __gc[]); That's how I tried to implment it as such. Anyway, without the 3 __gc
qualifier seems to make it compile, but does it mean that they are not
gc pointers?


As I already indicated:

http://msdn.microsoft.com/library/de...dquestions.asp

there you'll find:

// This makes the function compliant with the common language
// specification (usable in C# and Visual Basic).
void Function7( Byte (*theArray) [] )
{
*theArray = new Byte[ 123 ];
}You so tell the compiler to take a managed reference pointer to a managed
array.Just don't wonder about the systax... as you might know, managed C++
designer drovethis language extensions to another inconvenient level.
C++/CLI will do better!Greetings, Sebastian Dau
Nov 17 '05 #5
Thanks for the clarification. I read the article you mentioned and
thought the same. But just need some experts like you to reinforce the
idea.

This new syntax, do's and don'ts, for managed c++ is quite cumbersome.
I guess I just have to play with it more.

Nov 17 '05 #6

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

Similar topics

30
by: JKop | last post by:
When you want to store an integer in C++, you use an integral type, eg. int main() { unsigned char amount_legs_dog = 4; } In writing portable C++ code, there should be only two factors that...
3
by: Trishia Rose | last post by:
God dang it all, i am so sick of programmers who feel compelled that every single time they use an int variable, they give it some brand new name! for example they would take an innocent function...
134
by: jacob navia | last post by:
Hi Suppose you have somewhere #define BOOL int and somewhere else typedef BOOL int;
13
by: Anna | last post by:
I try to put 8 int bit for example 10100010 into one character of type char(1 octet) with no hope . Could anyone propose a simple way to do it? Thank you very much.
15
by: Andreas Eibach | last post by:
.... but I have an unsigned long value in the printf. This warning came when I used gcc 4.x to compile. .... unsigned long offset = 0; .... Well OK, an "easy" way would be instead of printf...
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.