我想为 CLANG/LLVM 运行一个示例插件。具体来说llvm\tools\clang\examples\PrintFunctionNames
。我设法构建了它,我看到了,PrintFunctionNames.exports
但我认为视觉工作室不支持它。该文件很简单_ZN4llvm8Registry*
。我不知道那是什么,但我怀疑它的命名空间 llvm,类 Registry 定义为
template <typename T, typename U = RegistryTraits<T> >
class Registry {
我怀疑关键行在示例文件的末尾
static FrontendPluginRegistry::Add<PrintFunctionNamesAction> X("print-fns", "print function names");
print-fns 是名称,而第二个参数是 desc。当我尝试通过加载/运行 dll
clang -cc1 -load printFunctionNames.dll -plugin print-fns a.c
我收到一个关于找不到的错误print-fns
。我怀疑它是因为静态变量永远不会被初始化,因此它永远不会注册插件。错误的 dll 名称会在加载模块消息时出错。
我创建了一个 def 文件并将其添加到我的项目中。它编译但仍然没有运气。这是我的def文件
LIBRARY printFunctionNames
EXPORTS
X DATA
我如何注册插件或让这个例子工作?