Friday, June 6, 2008

First Techno

This is my first technical post (of what is hopefully many to come). This is about a problem that guys new to OpenCV meet everytime that they start coding with vs2005. Why this does not happen with vs 6 is a mystery to me and i havent tried 2003 yet but i might in future.

The problem is that the first time an app is compiled, linked and run in vs2005 and linked to highgui.lib or highghid.lib, the user may get a MSVCR80.DLL not found  error. if you have done a fair bit of coding you know that this is microsoft vc runtime. so just how the heck come VS debugger cannot find it. the answer lies in taking a look at the exe built using dependency walker(http://www.dependencywalker.com/). The dependency walker is an invaluable tool in finding bugs and other problems in linking area. Also you can find a lot of meta info using this. Anyways a quick look in dependency walker of the exe you see that it links to both MSVCR80.dll and MSVCR80D.dll . and herein lies the problem. windows cant load two DLL's with identical methods and so on, just because they have two names. thus windows throws its hands up and says, ok i cant find this dll. (bad error reporting i know)

The culprit happens to be a lib included with highgui. there is a lib called jasper included with OpenCV. This lib for some reason (I think the reason is that the source is closed but i m really not sure) is included in a binary version. thus only the lib is present and it is a debug version. thus automatically it links to the debug version of vc runtime. but if the others are to run for release version then comes the problem. jasper and in turn highgui wants to link to msvcr80d.dll but others want msvcr80.dll. And we have the cause of the problem. I will post the solution next time.

No comments: