DSA_Sort不在libcomctl32.a中:对__imp_DSA_Sort的未定义引用

时间:2019-01-09 16:49:53

标签: mingw mingw-w64

使用GoogleMock和mingw 64编译测试应用程序。 即使我与comctl32链接,也会出现此错误::

In function `DSA_Sort(_DSA*, int (*)(void const*, void const*, long long), long long)':
C:/msys64/mingw64/x86_64-w64-mingw32/include/commctrl.h:5350: undefined reference to `__imp_DSA_Sort'

未链接到comctl32的其他__imp_DSA_XXX()未定义,例如__imp_DSA_DestroyCallback()objdump libcomctl32.a -t不显示DSA_Sort(),但显示DSA_DestroyCallback

V6.0.0源comctl32.def不显示DSA_Sort()。不过,它在commctrl.defcoredll.def中,当然还有commctrl.h

DSA_sort()中缺少的libcomctl32.a是mingw-w64的错误吗? 还是此功能在其他libxxx.a文件中?哪一个? 如果是错误,应该如何报告?

1 个答案:

答案 0 :(得分:0)

Comctl32.dll

ld \Windows\System32\comctl32.dll --output-def=comctl32.def

没有显示DSA_Sort(),尽管文档中说它应该在该位置。

DSA_Sort

https://docs.microsoft.com/en-us/windows/desktop/api/dpa_dsa/nf-dpa_dsa-dsa_sort

库:ComCtl32.dll

BOOL DSA_Sort(
  HDSA         pdsa,
  PFNDACOMPARE pfnCompare,
  LPARAM       lParam
);

dsa_dsa.h

\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\dpa_dsa.h

与MinGW DSA_Sort()相同,定义commctrl.h

但是如果定义了dpa_dsa.h#include "dpa_dsa.inl"ISOLATION_AWARE_ENABLED, MinGW不支持(https://sourceforge.net/p/mingw-w64/feature-requests/44/)。

\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\dpa_dsa.inl

包含:

#define DSA_Sort IsolationAwareDSA_Sort

并具有以下内联实现:

ISOLATION_AWARE_INLINE BOOL IsolationAwarePrivatenCv IsolationAwareDSA_Sort(_Inout_ HDSA pdsa,_In_ PFNDACOMPARE pfnCompare,_In_ LPARAM lParam)
{
    BOOL fResult = FALSE;
    typedef BOOL (WINAPI* PFN)(_Inout_ HDSA pdsa,_In_ PFNDACOMPARE pfnCompare,_In_ LPARAM lParam);
    static PFN s_pfn;
    PFN __IsolationAware_pfn = s_pfn;
    ULONG_PTR ulpCookie = 0;
    const BOOL fActivateActCtxSuccess =
        IsolationAwarePrivateT_SAbnPgpgk ||
        IsolationAwarePrivateT_SqbjaYRiRY ||
        IsolationAwarePrivatenPgViNgRzlnPgpgk(&ulpCookie);
    if (!fActivateActCtxSuccess)
        return fResult;
    __try
    {
        if (__IsolationAware_pfn == NULL)
        {
            __IsolationAware_pfn = (PFN) Dpa_dsaIsolationAwarePrivatetRgCebPnQQeRff_pbZPgYQP_QYY("DSA_Sort");
            if (__IsolationAware_pfn == NULL)
                __leave;
            s_pfn = __IsolationAware_pfn;
        }
        fResult = __IsolationAware_pfn(pdsa,pfnCompare,lParam);
    }
    __finally
    {
        if (!IsolationAwarePrivateT_SAbnPgpgk
         || !IsolationAwarePrivateT_SqbjaYRiRY
        )
        {
            const BOOL fPreserveLastError = (fResult == FALSE);
            const DWORD dwLastError = fPreserveLastError ? GetLastError() : NO_ERROR;
            (void)IsolationAwareDeactivateActCtx(0, ulpCookie);
            if (fPreserveLastError)
                SetLastError(dwLastError);
        }
    }
    return fResult;
}

使用

#if !ISOLATION_AWARE_USE_STATIC_LIBRARY
FARPROC IsolationAwarePrivatenCv Dpa_dsaIsolationAwarePrivatetRgCebPnQQeRff_pbZPgYQP_QYY(LPCSTR pszProcName);
#endif /* ISOLATION_AWARE_USE_STATIC_LIBRARY */

Windows API似乎已在MinGW中显式隐藏了此功能。

另请参阅: https://www.geoffchappell.com/studies/windows/shell/comctl32/api/da/dsa/index.htm