[Mono-devel-list] P/Invoke wierdness

Paolo Molaro lupus at ximian.com
Sun Feb 13 10:54:08 EST 2005

On 02/12/05 James Fitzsimons wrote:
> I get the following error:
> james at athos src $ mono CvImage.exe 
> CvImage test application
> =============================
> Loading image
> mono: symbol lookup error: /usr/local/lib/libhighgui.so: undefined
> symbol: cvCreateImage

This means that /usr/local/lib/libhighgui.so is not linked correctly:
running ldd /usr/local/lib/libhighgui.so should report a link
to libopencv (where I guess cvCreateImage is defined) and likely doesn't.
The way that library is compiled should be fixed. A possible
workaround is to dllimport and call a function from libopencv
before a call is made to a function in libhighgui.so.

> Which is strange because libhighgui should be calling the cvCreateImage
> in libopencv directly...
> If I change my application to call the cvCreateImage method in libopencv
> directly instead of going via libhighgui like so:
> CvImage image = new CvImage(new CvSize(100,100), 8, 3);
> I get this:
> james at athos src $ mono CvImage.exe 
> CvImage test application
> =============================
> Unhandled Exception: System.DllNotFoundException: opencv
> in <0x0004a> (wrapper managed-to-native) Slam.CvImage:cvCreateImage
> (Slam.CvSize,int,int)
> in <0x00029> Slam.CvImage:.ctor (Slam.CvSize,int,int)
> in <0x00062> Slam.MainClass:Main (string[])
> Huh? How come it can find libhighgui and not libopencv when they are in
> exactly the same location?

As detailed in the mono man page, setting the env vars:
is the best way to see what the error is.


lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better

More information about the Mono-devel-list mailing list