ImageCodecInfo and GetEncoders

S

Steve McLellan

Hi,

I'm trying to call GetEncoders in C++. I've got code that does it
successfully in C# but whatever I do I seem to get errors.

The lines below, which is my current hacked off state, cause the problem:

System::Drawing::Imaging::ImageCodecInfo __gc *encoders __gc[];
encoders = System::Drawing::Imaging::ImageCodecInfo::GetImageEncoders();

The error is error C2691: 'unsigned char __gc[]' : invalid type for __gc
array element

Any help much appreciated, before I rampage murderously through the office.

Steve
 
R

Ronald Laeremans [MSFT]

VC does not support .Net jagged arrays (arrays of arrays) in the 7.0 and 7.1
releases. The only reasonable workaround I know of is to write an
intermediate class in another language (probably C# would be the closest)
that turns the jagged array into a rectangular array.

There is virtually no use of jagged arrays in the .Net framework and this
specific function is one of the very rare exceptions.

Ronald Laeremans
Visual C++ team
 
S

Steve McLellan

Doh! I was hoping this wasn't the cause of the problem, but it seems I'm
wrong... if I'm going to have to write a C# wrapper I might as well do the
whole function in C# (it's for saving a file). Presumably in this case I can
write a C# function that takes a string and a System.Drawing.Image type? Not
had much experience with wrapping in .NET. Out of interest, is this going to
be remedied in Whidbey?

Thanks,

Steve

Ronald Laeremans said:
VC does not support .Net jagged arrays (arrays of arrays) in the 7.0 and 7.1
releases. The only reasonable workaround I know of is to write an
intermediate class in another language (probably C# would be the closest)
that turns the jagged array into a rectangular array.

There is virtually no use of jagged arrays in the .Net framework and this
specific function is one of the very rare exceptions.

Ronald Laeremans
Visual C++ team

Steve McLellan said:
Hi,

I'm trying to call GetEncoders in C++. I've got code that does it
successfully in C# but whatever I do I seem to get errors.

The lines below, which is my current hacked off state, cause the problem:

System::Drawing::Imaging::ImageCodecInfo __gc *encoders __gc[];
encoders = System::Drawing::Imaging::ImageCodecInfo::GetImageEncoders();

The error is error C2691: 'unsigned char __gc[]' : invalid type for __gc
array element

Any help much appreciated, before I rampage murderously through the office.

Steve
 
R

Ronald Laeremans [MSFT]

Yes, it is remedied in Whidbey.

Ronald

Steve McLellan said:
Doh! I was hoping this wasn't the cause of the problem, but it seems I'm
wrong... if I'm going to have to write a C# wrapper I might as well do the
whole function in C# (it's for saving a file). Presumably in this case I can
write a C# function that takes a string and a System.Drawing.Image type? Not
had much experience with wrapping in .NET. Out of interest, is this going to
be remedied in Whidbey?

Thanks,

Steve

Ronald Laeremans said:
VC does not support .Net jagged arrays (arrays of arrays) in the 7.0 and 7.1
releases. The only reasonable workaround I know of is to write an
intermediate class in another language (probably C# would be the closest)
that turns the jagged array into a rectangular array.

There is virtually no use of jagged arrays in the .Net framework and this
specific function is one of the very rare exceptions.

Ronald Laeremans
Visual C++ team

Steve McLellan said:
Hi,

I'm trying to call GetEncoders in C++. I've got code that does it
successfully in C# but whatever I do I seem to get errors.

The lines below, which is my current hacked off state, cause the problem:

System::Drawing::Imaging::ImageCodecInfo __gc *encoders __gc[];
encoders = System::Drawing::Imaging::ImageCodecInfo::GetImageEncoders();

The error is error C2691: 'unsigned char __gc[]' : invalid type for __gc
array element

Any help much appreciated, before I rampage murderously through the office.

Steve
 

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