Re: Multi dimensional arrays in C# and in C++
- From: "Hans" <Hans@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 4 May 2005 03:51:02 -0700
"Kapil Khosla [MSFT]" wrote:
>
>
> "Hans" wrote:
>
> > The code compiles alright, but when debugging, the assembly loader throws
> > exception System.TypeLoadException:
> > "Method get_MyProperty in type MyNamespace.MyImplementation from assembly
> > MyImplementation, Version=, Culture=, PublicKeyToken= does not have an
> > implementation."
> >
> > When I change
> > > > double[ , ] MyProperty {get;}
> > to
> > double[ ] MyProperty {get;}
> >
> > (at all places), the assembly loads without a problem...
> >
> > Have you tried to execute the code or did you compile it only?
> >
> > regards, Hans.
> >
> > "Kapil Khosla [MSFT]" wrote:
> >
> > >
> > >
> > > --
> > > This posting is provided "AS IS" with no warranties, and confers no
> > > rights."Use of included script samples are subject to the terms specified at
> > > http://www.microsoft.com/info/cpyright.htm"
> > >
> > > "Hans" <Hans@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> > > news:07068F9C-C5E4-453E-87A2-597A9E8A7741@xxxxxxxxxxxxxxxx
> > > >I have encapsultated old C/C++ code in a mixed mode C++ module (Project 2).
> > > > In my C# app (project 3) I instanciate a managed C++ class. The behaviour
> > > > of
> > > > the C/C++ class is defined by an interface (Project 1). I wanted to add a
> > > > getter property to a multi dimension array, but the assembly loader keeps
> > > > telling me that the property is not implemented...
> > > > When I make a single dimensional array out of it, it works fine...
> > > >
> > > > I added a simplified example of what I did below. Can anybody tell me how
> > > > I
> > > > can get this working???
> > > >
> > > > Thanx, Hans.
> > > >
> > > > file 'IMyInterface.cs' (Project 1)
> > > > namespace MyNamespace
> > > > {
> > > > public interface IMyInterface
> > > > {
> > > > double[,] MyProperty {get;}
> > > > }
> > > > }
> > > >
> > > > file 'MyImplementation.h' (Project 2, MyImplementation.cpp is omitted)
> > > > using namespace MyNamespace;
> > > > [assembly:System::CLSCompliant(true)];
> > > > namespace MyNamespace
> > > > {
> > > > public __gc class MyImplementation: public MyNamespace::IMyInterface
> > > > {
> > > > private:
> > > > double m_MyMember __gc [,];
> > > > public:
> > > > __property double get_MyProperty() __gc[,] {return m_MyMember;}
> > > > }
> > > > }
> > > >
> > > > file 'MyApp.cs' (Project 3)
> > > > namespace MyNamespace
> > > > {
> > > > ...
> > > > ...
> > > > void MyMethod()
> > > > {
> > > > IMyInterface myInterface = new MyImplementation(); // causes an
> > > > exception...
> > > > // How can I get this working?
> > > > }
> > > > }
> > > >
> > >
> > >
> > > I cannot repro your behavior. Could it be that you are not referencing all
> > > your assemblies. This is how verified your repro. I just renamed your
> > > MyImplementation.h to MyImplementation.cpp.
> > >
> > > csc /t:library IMyInterface.cs
> > > cl /clr:oldSyntax /LD MyImplementation.cpp
> > > csc /r:MyImplementation.dll /r:IMyInterface.dll MyApp.cs
> > >
> > > RESULT: Successful compile with no exception ?
> > >
> > > Thanks,
> > > Kapil
> > >
> > >
> > >
>
>
> I did execute the app last time too and got no exception. I am working with
> beta2 though, what compiler/IDE are you working on?
> Thanks
> Kapil
Developer studio 7.1.3088,
Microsoft Visual C# .NET 69461-335-0000007-18487,
Microsoft Visual C++ .NET 69461-335-0000007-18487
regards, Hans.
.
- References:
- Multi dimensional arrays in C# and in C++
- From: Hans
- Re: Multi dimensional arrays in C# and in C++
- From: Kapil Khosla [MSFT]
- Re: Multi dimensional arrays in C# and in C++
- From: Hans
- Re: Multi dimensional arrays in C# and in C++
- From: Kapil Khosla [MSFT]
- Multi dimensional arrays in C# and in C++
- Prev by Date: Re: Native classes in managed class interfaces
- Next by Date: Re: Managed referencing non-managed and vice-versa
- Previous by thread: Re: Multi dimensional arrays in C# and in C++
- Next by thread: Re: Multi dimensional arrays in C# and in C++
- Index(es):
Relevant Pages
|