Skip to content

使用 STDMETHODIMP 而非 STDAPI 定义 COM 类成员函数 #1834

@cqjjjzr

Description

@cqjjjzr

WeaselTSF 中有不少成员函数使用了 STDAPI (即自动 extern "C")定义成员函数,例如:

STDAPI WeaselTSF::DoEditSession(TfEditCookie ec) {

参照 C++26 的 9.12 [dcl.link]/5:

A linkage-specification shall inhabit a namespace scope.
A C language linkage is ignored in determining the language linkage of class members, friend functions with a trailing requires-clause, and the function type of non-static class member functions.

STDMETHODIMP 没有这个 extern "C"

另外,这个 extern "C" 会造成 Resharper C++ 等分析工具出错(我这里把所有类成员引用全部报成了 unresolved symbol)

请考虑将所有类成员函数定义中的 STDAPI 换成 STDMETHODIMP。

如果合适,我可以交 PR。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions