[Mono-bugs] [Bug 352200] New: Bug in managed-to-native wrapper

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Jan 7 22:14:38 EST 2008


https://bugzilla.novell.com/show_bug.cgi?id=352200


           Summary: Bug in managed-to-native wrapper
           Product: Mono: Runtime
           Version: 1.2.6
          Platform: x86
        OS/Version: Windows Vista
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: interop
        AssignedTo: mono-bugs at ximian.com
        ReportedBy: yoavhacohen at gmail.com
         QAContact: mono-bugs at ximian.com
          Found By: ---


Created an attachment (id=189661)
 --> (https://bugzilla.novell.com/attachment.cgi?id=189661)
A test program that you can use to reproduce the problem. (OpenCV\bin\*.dll
should be copied to windows\system32 folder).

Description of Problem:
I try to call the following native function of OpenCV:
/* Retrieves image ROI */
CVAPI(CvRect) cvGetImageROI( const IplImage* image );

Where  CvRect is the struct:

typedef struct CvRect
{
    int x;
    int y;
    int width;
    int height;
}
CvRect;

and the P/Invoke declareation in my code is:
[DllImport("cxcore100.dll")]
        internal static unsafe extern __CvRect cvGetImageROI(IntPtr image);

internal struct __CvRect
    {
        public int x;
        public int y;
        public int width;
        public int height;

        public __CvRect(Rectangle rect)
        {
            x = rect.X; y = rect.Y; width = rect.Width; height = rect.Height;
        }
    }

The problem is that this call does not work on mono although it does work on
Net.


Steps to reproduce the problem:
1. Download the code from
http://opencvdotnet.googlecode.com/svn/trunk/src/sandbox or extract the files
from the attached file.
2. Save the original OpenCV dll files (Usually at C:\program files\OpenCV\Bin\)
in your C:\windows\System32\  folder.
3. Compile the code and run Test.exe


Actual Results:
Stacktrace:

  at (wrapper managed-to-native) OpenCVDotNet.PInvoke.cvGetImageROI (intptr)
<0x
00004>
  at (wrapper managed-to-native) OpenCVDotNet.PInvoke.cvGetImageROI (intptr)
<0x
ffffffff>
  at OpenCVDotNet.CVImage.get_RegionOfInterest () <0x00064>
  at OpenCVDotNet.CVImage.Split () <0x00054>
  at OpenCVDotNet.CVImage.CalcHistogram
(int[],OpenCVDotNet.CVPair[],OpenCVDotNe
t.CVImage) <0x0009e>
  at OpenCVDotNet.CVImage.CalcHistogram (int,OpenCVDotNet.CVImage) <0x0012a>
  at OpenCVDotNet.CVImage.CalcHistogram (int) <0x0000f>
  at Test.Program.Main (string[]) <0x00036>
  at (wrapper runtime-invoke) Test.Program.runtime_invoke_void_string[]
(object,
intptr,intptr,intptr) <0xffffffff>


Expected Results:
Should work fine (it's work fine on Vista with .NET).

How often does this happen? 
Always.

Additional Information:
N/A


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list