[Mlir-commits] [mlir] [mlir] Workaround for export lib generation on Windows for `mlir_arm_sme_abi_stubs` (PR #73147)
Stella Laurenzo
llvmlistbot at llvm.org
Wed Nov 22 18:44:18 PST 2023
================
@@ -10,6 +10,20 @@
#include <cstdint>
#include <iostream>
+#ifdef _WIN32
+#ifndef MLIR_ARMSMEABISTUBS_EXPORT
+#ifdef mlir_arm_sme_abi_stubs_EXPORTS
+// We are building this library
+#define MLIR_ARMSMEABISTUBS_EXPORT __declspec(dllexport)
+#else
+// We are using this library
+#define MLIR_ARMSMEABISTUBS_EXPORT __declspec(dllimport)
+#endif // mlir_arm_sme_abi_stubs_EXPORTS
+#endif // MLIR_ARMSMEABISTUBS_EXPORT
+#else
+#define MLIR_ARMSMEABISTUBS_EXPORT LLVM_ATTRIBUTE_WEAK
----------------
stellaraccident wrote:
To be fully resilient, you would also add `__attribute__((visibility("default"))`, which would make this target compatible with -fvisiblity=hidden build modes (which gets used for a lot of deployment cases because it generates more efficient binaries).
I might suggest lining the terminology and style of ifdefs with how we do this for the CAPI: https://github.com/llvm/llvm-project/blob/main/mlir/include/mlir-c/Support.h#L46
I think:
* `#ifdef _WIN32` -> `#if (defined(_WIN32) || defined(__CYGWIN__))`
* `MLIR_ARMSMEABISTUBS_EXPORT` -> `MLIR_ARMSMEABISTUBS_EXPORTED`
Since this is unconditionally/always a shared library, you can leave out the check for an equiv of `MLIR_CAPI_ENABLE_WINDOWS_DLL_DECLSPEC`.
https://github.com/llvm/llvm-project/pull/73147
More information about the Mlir-commits
mailing list