Summary: Is there any tiny example on how to build the Win32 C++ console application that uses the libgit2 library (sources available at GitHub)?
I
This strongly suggests a calling convention mismatch to me. libgit2 uses __stdcall
by default, for a number of reasons, while Visual Studio defaults to creating projects that use the __cdecl
calling convention. While your program can use either calling convention and successfully call libgit2 using a different one, the easiest solution is probably just to use the same calling convention for both.
When you configure libgit2, you can turn off the STDCALL
flag, which will cause it to emit a library built with __cdecl
calling conventions:
cmake %PATH_TO_LIBGIT2_SOURCE% -DTHREADSAFE=ON -DSTDCALL=OFF
cmake --build .