OpenCV in MFC App
-
I don't know the details of building the OpenCV libraries. I know there is a BUILD_SHARED_LIBS flag, but I don't know if you can set that to OFF (like you have done) and somewhere else specify the /MD switch and have it correctly build all the lib files without a dependency on the DLLs. Soren Madsen
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty
I created a WIN32 console application and statically linked the OpenCV. The final exe is little less than 4 MB. This kinda proves that there's a overhead when using MFC with statically linked lib's. For my purpose this works fine, as the OpenCV will ultimately be running in a WIN32 DLL. Thanks SoMad for your suggestions! Now the next part am working on is adding an XML file to the project and compiling it into the project.
-
I created a WIN32 console application and statically linked the OpenCV. The final exe is little less than 4 MB. This kinda proves that there's a overhead when using MFC with statically linked lib's. For my purpose this works fine, as the OpenCV will ultimately be running in a WIN32 DLL. Thanks SoMad for your suggestions! Now the next part am working on is adding an XML file to the project and compiling it into the project.
:thumbsup: It sounds like you are making progress. There is another approach to this and that is how I often deal with these kind of scenarios where I need to include 3rd party libraries (like Live555 and FFmpeg), but I want to reduce the number of distributable files and the interdependency of those files. Since you just mentioned the WIN32 DLL, this might also be what you are planning on doing in the end. Instead of just building the EXE and distributing that, I build the EXE and a DLL for interfacing to the 3rd party library. That way I can tailor the DLL to work with the 3rd party library according to my needs, while compiling the library according to its needs. You should be able to build your DLL with the /MT setting and build your EXE with the /MD and Shared MFC DLL setting then dynamically load the DLL. Soren Madsen
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty
-
I created a WIN32 console application and statically linked the OpenCV. The final exe is little less than 4 MB. This kinda proves that there's a overhead when using MFC with statically linked lib's. For my purpose this works fine, as the OpenCV will ultimately be running in a WIN32 DLL. Thanks SoMad for your suggestions! Now the next part am working on is adding an XML file to the project and compiling it into the project.
Don Guy wrote:
Now the next part am working on is adding an XML file to the project and compiling it into the project.
I assume you are putting it in the resource. XResFile - Files Stored in Resources: Part 1 - Text and Binary[^] Soren Madsen
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty