Re: Problem calling a .COM component in :NET with C#
From: Murat KARATUTLU (muratk_at_uekae.tubitak.gov.tr)
Date: 07/20/04
- Next message: Murat KARATUTLU: "Re: Sorting a listitem by a custom field"
- Previous message: Julia: "How do i remove xmlns:xsd when serialize?"
- In reply to: Alfonso: "Problem calling a .COM component in :NET with C#"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 20 Jul 2004 14:00:48 +0300
The problem might not be Array type but the argument type.
as you see the API function accepts a reference (byref in VB, ref in C#) to
the array of integers, the the array itself.
So you may declare a variable to reference the array and send it to the
function as an [in] arg.
e.g.
to call a function like:
void SomeFunction(ref int x, int y) {
//implementation goes here
}
you should:
int _x = 10;
int _y = 20;
SomeFunction(ref _x, _y);
but you can NOT
SomeFunction(10, 20);
PS: Also casting may be required for the array type
"Alfonso" <alfonso.navarro@epfl.ch> wrote in message
news:883ba3fb.0407200219.14c82e11@posting.google.com...
> Hello,
>
>
> I am implementing a hanwritting recognition benchmark, and when
> calling from
> my C# code the API of a HWr engine I have the following
>
> Code:
>
> int[] strokes = {myInt1, myInt2, myInt3, myInt4};
> ink.AddStroke(strokes);
>
> problem:
>
> Argument '1': cannot convert from 'int[]' to 'ref System.Array'
>
> Description of API:
>
> 4.2.2.1 AddStroke, AddStrokeXY
> Index = object .AddStroke(Ink ) Index = object .AddStrokeXY(InkX, InkY
> )
> Description
> Adds a stroke to the object.
> Returns assigned zero-based index of the added stroke in the stroke
> array.
> o object is an object expression that evaluates to a riteFormInk
> object.
> o Ink is an array of Longs (in Visual Basic) or Integers (in VB.NET),
> representing
> strokes (X-value in the lower word and Y-value in the upper word).
> o InkX is an array of Integers (in Visual Basic) or Shorts (in
> VB.NET), represented X-values
> of points.
> o InkY is an array of Integers (in Visual Basic) or Shorts (in
> VB.NET), represented Y-values
> of points.
> o Index is a variable of the type Long (in Visual Basic) or Integer
> (in VB.NET) or
> Variant.
> Comment
> Those methods cannot be used in scripting languages that doesn't
> support typed variables
> (like VBScript and JScript).
>
>
>
> I have another code implementet VB .NET which calls the same function
> with an array of Ints and works well.
>
> Any hint?
>
> thanks
>
>
> Alfonso
- Next message: Murat KARATUTLU: "Re: Sorting a listitem by a custom field"
- Previous message: Julia: "How do i remove xmlns:xsd when serialize?"
- In reply to: Alfonso: "Problem calling a .COM component in :NET with C#"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|