forked from mesonbuild/meson-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,6 @@ | |
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
int sum(int a, int b); | ||
#include "mypkg_dll.h" | ||
|
||
MYPKG_DLL int sum(int a, int b); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#pragma once | ||
|
||
// MYPKG_DLL | ||
// inspired by https://github.com/abseil/abseil-cpp/blob/20240116.2/absl/base/config.h#L736-L753 | ||
// and https://github.com/scipy/scipy/blob/9ded83b51099eee745418ccbb30196db96c81f3f/scipy/_build_utils/src/scipy_dll.h | ||
// | ||
// When building the `examplelib` DLL, this macro expands to `__declspec(dllexport)` | ||
// so we can annotate symbols appropriately as being exported. When used in | ||
// headers consuming a DLL, this macro expands to `__declspec(dllimport)` so | ||
// that consumers know the symbol is defined inside the DLL. In all other cases, | ||
// the macro expands to nothing. | ||
// Note: MYPKG_DLL_{EX,IM}PORTS are set in mypkg/meson.build | ||
#if defined(MYPKG_DLL_EXPORTS) | ||
#define MYPKG_DLL __declspec(dllexport) | ||
#elif defined(MYPKG_DLL_IMPORTS) | ||
#define MYPKG_DLL __declspec(dllimport) | ||
#else | ||
#define MYPKG_DLL | ||
#endif |