M
mupe
Hi,
i have a problem with a Type Library, which is written in C++.
I am developing an application in C#.NET and have to use functions from
this COM-Type Library. When I use these functions in the "old" VB it
works but not in .NET. I think it is a problem with marshalling but I
could not find a solution yet.
First I included the Type Library in VS.NET 2003. Other functions of
the TL work so the reference to the Lib must be correct.
Here the piece of code in C#.NET:
app = new nwApplication();
int[] id = new int[2];
id[0] = 1;
id[1] = 2;
broadcast = app.get_broadcast(id);
app is an Application-Object of the Library. The array id has two
numbers. The get_broadcast method needs this array as parameter and
returns a broadcast-object.
Here is the PROBLEM. I seems that the get_broadcast method does not get
the content of the array correctly.
I tried it in VB like this:
Dim app, broadcast, id
id = Array(1,2)
Set app = CreateObject("NwLib.nwApplication")
Set broadcast = app.get_broadcast(id)
This works correctly.
When I look for the get_broadcast message in the object browser the
definition is like this:
nwApplication.get_broadcast(object)
When i compile my project, VS.NET creates a Interop.nw.dll. I
disassembled it to IL and looked for the definitions of the method. It
was like this:
......... get_broadcast(object marshal( struct) Value)....
Is it possible that the array in C# is not correctly marshalled?
Has anyone an idea where the problem could be? Thanks very much!
Peter
i have a problem with a Type Library, which is written in C++.
I am developing an application in C#.NET and have to use functions from
this COM-Type Library. When I use these functions in the "old" VB it
works but not in .NET. I think it is a problem with marshalling but I
could not find a solution yet.
First I included the Type Library in VS.NET 2003. Other functions of
the TL work so the reference to the Lib must be correct.
Here the piece of code in C#.NET:
app = new nwApplication();
int[] id = new int[2];
id[0] = 1;
id[1] = 2;
broadcast = app.get_broadcast(id);
app is an Application-Object of the Library. The array id has two
numbers. The get_broadcast method needs this array as parameter and
returns a broadcast-object.
Here is the PROBLEM. I seems that the get_broadcast method does not get
the content of the array correctly.
I tried it in VB like this:
Dim app, broadcast, id
id = Array(1,2)
Set app = CreateObject("NwLib.nwApplication")
Set broadcast = app.get_broadcast(id)
This works correctly.
When I look for the get_broadcast message in the object browser the
definition is like this:
nwApplication.get_broadcast(object)
When i compile my project, VS.NET creates a Interop.nw.dll. I
disassembled it to IL and looked for the definitions of the method. It
was like this:
......... get_broadcast(object marshal( struct) Value)....
Is it possible that the array in C# is not correctly marshalled?
Has anyone an idea where the problem could be? Thanks very much!
Peter