VC7 + managed overrides.. please help

B

Ben Harper

I am stuck using VC7 right now, so I can't test this on 7.1, but I believe it is a bug in the compiler, although I hope it isn't.
Please could someone confirm this for me, prove me wrong, or suggest a workaround.

I am trying to override GetCompiledState in IVsaSite.
I have a class that implements IVsaSite.
All other methods override fine, except for this one.

This is the function definition given in the (VC7) help:

void GetCompiledState(
unsigned char** pe __gc[],
unsigned char** debugInfo __gc[]
);

Firstly- that definition does not compile at all. We get:
"error C2691: 'unsigned char __gc ** ' : invalid type for __gc array element."

The definition given in the 7.1 help is a bit different, but doesn't compile either.

Now, I have tried NUMEROUS other ways of defining this function, none of which work.

This is the closest I have got:

typedef System::Byte MyByte;

void IVsaSite::GetCompiledState(
MyByte (*pe) __gc [],
MyByte (*debugInfo) __gc [] )

This is correct (looking at ildasm output), except for one thing: the [Out] attribute.
So, if I try and add the [Out] attribute (or it's fully qualified name), like this:

void IVsaSite::GetCompiledState(
[System::Runtime::InteropServices::Out] MyByte (*pe) __gc [],
[System::Runtime::InteropServices::Out] MyByte (*debugInfo) __gc [] )

I get the follow error, which is what I believe is a bug in the compiler:
error C2337: 'System::Runtime::InteropServices::Out' : attribute not found; it is neither a built-in nor a custom attribute that is accessible in the current namespace

It seems as though the compiler will not accept any new namespaces after the IVsaSite:: statement. Even System::Byte is not allowed, which is why I typedefd it. If I exclude the IVsaSite:: statement, then the compiler accepts the [Out] attribute just fine, but then the function does not implement IVsaSite.

PLEASE... can anybody help?
I would love to be able to program this is C#, but am unable to do so.

I would greatly appreciate a workaround, or explanation of what I am doing wrong.
Thank you.

Ben Harper.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top