7zip build fail with LzFind.c(1613,30): error C2440: void (__stdcall *)(UInt32,CLzRef *,const CLzRef *)”->“LZFIND_SATUR_SUB_CODE_FUNC

  7zip, c++, visual-c++

I’m trying to build 7-zip(7z2103-src.7z) with visual studio 2019.
I opened 7zip_srcBundlesFmFM.dsw and convert it to vcxproj by vs 2019.
Then set /Zi and /Gy for project and build it.

vs 2019 gives following errors:

1>LzFind.c
1>=== LzFind SSE41
1>C:Projectzip-sizeCLzFind.c(1606,28): error C2440: "=": Cannot convert “void (__stdcall *)(UInt32,CLzRef *,const CLzRef *)" to "LZFIND_SATUR_SUB_CODE_FUNC"
1>=== LzFind AVX2
1>C:Projectzip-sizeCLzFind.c(1613,30): error C2440: "=": Cannot convert “void (__stdcall *)(UInt32,CLzRef *,const CLzRef *)" to "LZFIND_SATUR_SUB_CODE_FUNC"

But I build successful by nmake (nmake CPU=AMD64 NEW_COMPILER=1 MY_STATIC_LINK=1), is there more settings required for this project?

piece of code occur error in 7-zip source:

MY_NO_INLINE
static
#ifdef ATTRIB_SSE41
ATTRIB_SSE41
#endif
void LzFind_SaturSub_128(UInt32 subValue, CLzRef *items, const CLzRef *lim)
{
  v128 sub2 =
    #ifdef MY_CPU_ARM_OR_ARM64
      vdupq_n_u32(subValue);
    #else
      _mm_set_epi32((Int32)subValue, (Int32)subValue, (Int32)subValue, (Int32)subValue);
    #endif
  do
  {
    SASUB_128(0)
    SASUB_128(1)
    SASUB_128(2)
    SASUB_128(3)
    items += 4 * 4;
  }
  while (items != lim);
}

......


void LzFindPrepare()
{
  #ifndef FORCE_SATUR_SUB_128
  #ifdef USE_SATUR_SUB_128
  LZFIND_SATUR_SUB_CODE_FUNC f = NULL;
  #ifdef MY_CPU_ARM_OR_ARM64
  {
    if (CPU_IsSupported_NEON())
    {
      #pragma message ("=== LzFind NEON")
      _PRF(printf("n=== LzFind NEONn"));
      f = LzFind_SaturSub_128;
    }
    // f = 0; // for debug
  }
  #else // MY_CPU_ARM_OR_ARM64
  if (CPU_IsSupported_SSE41())
  {
    #pragma message ("=== LzFind SSE41")
    _PRF(printf("n=== LzFind SSE41n"));
    f = LzFind_SaturSub_128;

    #ifdef USE_AVX2
    if (CPU_IsSupported_AVX2())
    {
      #pragma message ("=== LzFind AVX2")
      _PRF(printf("n=== LzFind AVX2n"));
      f = LzFind_SaturSub_256; // <- Error occurred here
    }
    #endif
  }
  #endif // MY_CPU_ARM_OR_ARM64
  g_LzFind_SaturSub = f;
  #endif // USE_SATUR_SUB_128
  #endif // FORCE_SATUR_SUB_128
}

Source: Windows Questions C++

LEAVE A COMMENT