[PATCH] D72384: [mlir] mlir-cpu-runner test's cblas_interface should export functions on Windows

Alex Zinenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 9 01:49:31 PST 2020


ftynse accepted this revision.
ftynse marked an inline comment as done.
ftynse added inline comments.
This revision is now accepted and ready to land.


================
Comment at: mlir/test/mlir-cpu-runner/include/cblas_interface.h:13-25
+#ifdef _WIN32
+#ifndef MLIR_CBLAS_INTERFACE_EXPORT
+#ifdef cblas_interface_EXPORTS
+/* We are building this library */
+#define MLIR_CBLAS_INTERFACE_EXPORT __declspec(dllexport)
+#else
+/* We are using this library */
----------------
kernhanda wrote:
> ftynse wrote:
> > This is a third occurrence of a similar macro definition. Would it be possible to generalize it somehow and have only one? 
> AFAICT, no. Three separate shared modules are created, each with their own exports. Furthermore, the three headers are all used within `cblas_interface`, so the macro can't be shared, because defining it would be telling the Windows linker that all the functions should be exported, instead of just the ones that are defined in `cblas_interface`.
> 
> The only other way is to have a shared preprocessor symbol between the three modules, but set it to different numerical values, which would be the way the different usages are identified.
> 
> Thoughts? I would suggest leaving it as is.
Works for me. This seems to be the last "library" file for the runner, so the number of macros should not grow uncontrollably.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72384/new/

https://reviews.llvm.org/D72384





More information about the llvm-commits mailing list