opencv_world.dll - how to use .lib ?

asked 2017-11-03 18:00:47 -0500

Nbb gravatar image

I compiled opencv from source using cmake gui and visual studio and selected the option to create the opencv_world files. When I run my code it tells me that opencv_world300.dll is missing and so I put it in my project folder. Will my code run slower because I am using a .dll file instead of a .lib file ? I am building a real-time application so it is important that I do not use settings or files that make my code run slower.

Should I reinstall OpenCV and not select the opencv_world option ? Because when I did that long ago it never gives me any missing dll errors.

edit retag flag offensive close merge delete


"Will my code run slower because I am using a .dll file instead of a .lib file ? " -- this is entirely unrelated. where did you get such an idea ?

berak gravatar imageberak ( 2017-11-04 03:35:18 -0500 )edit

i always read that dynamically linked libraries take a longer run time compared to static libraries ? If this isnt true then I guess I should just stick to the dlls ?

Nbb gravatar imageNbb ( 2017-11-04 04:26:10 -0500 )edit

It sounds like you're using the lib and the DLL at the same time.

See, you could use the lib, or use function pointers and GetProcAddress(), to access the functions in the DLL. Try both and see what difference it makes, if any.

sjhalayka gravatar imagesjhalayka ( 2017-11-04 12:25:26 -0500 )edit

how do i use the lib only ?

Nbb gravatar imageNbb ( 2017-11-05 09:50:49 -0500 )edit

If it's possible, it would be done through compiling the lib yourself from the OpenCV source code.

sjhalayka gravatar imagesjhalayka ( 2017-11-05 10:41:07 -0500 )edit

Do you know the difference between a regular function and an inline function? Is that the kind of difference in performance that you're looking for... no function call overhead?

That would require that you build the OpenCV sources into your main Visual Studio project/solution, and that you mark the functions as inline (using the inline keyword or __forceinline keyword). Basically you'd end up with a gigantic EXE file that contains OpenCV's hundreds of functions. Not only that, the functions that are called are inlined (duplicated, if you may), which makes the EXE even bigger.

sjhalayka gravatar imagesjhalayka ( 2017-11-05 19:34:26 -0500 )edit

@berak and @Nbb. Used Visual Studio, Unix, C++, perl, fortran, etc Lib can be convert into dll.

supra56 gravatar imagesupra56 ( 2017-11-07 07:41:36 -0500 )edit

@sjhalayka. The OpenCV can created inside Visual Studio to make Dll. You can used any Unix, perl fortran etc

supra56 gravatar imagesupra56 ( 2017-11-07 07:43:56 -0500 )edit