zbar
zbar copied to clipboard
mingw execution fails when calling function from *.dll
So I'm using g++.exe (MinGW-W64 x86_64-posix-seh, built by Brecht Sanders) 10.2.0 latest stable release 0.23.90(the problem arises for all four builds under windows)
Basically I try to create x64 solution, but I tried use zbar for both architecture
So my problem is crashing of the program
If I comment the only line in func
function(which is never called) everything executes as it suppose, but if I try to run following code, execution fails
I realized that program crashes in both ImageScanner's constructor and destructor when function from *.dll is called, but I can do nothing with it
So my code is
#include <iostream>
#include <zbar.h>
void func()
{
zbar::ImageScanner scanner;
}
int main() {
std::cerr << "aaaaaaaa\n";
std::cout << "aaaaaaaa\n";
}
My CMakelists.txt looks like
cmake_minimum_required(VERSION 3.19)
project(project)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
include_directories(${CMAKE_SOURCE_DIR}/include)
link_directories(${CMAKE_SOURCE_DIR}/lib)
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} zbar)
rest of files is taken from zbar, and in general my project looks like this
steps to repro:
mkdir build && cd build
cmake .. -G "MinGW Makefiles"
make
cd ../bin
./project.exe