|
version 1.1.1.2, 2012/05/29 09:29:43
|
version 1.1.1.3, 2021/03/17 13:38:46
|
|
Line 1
|
Line 1
|
| /* Exporting symbols from Cygwin shared libraries. |
/* Exporting symbols from Cygwin shared libraries. |
| Copyright (C) 2006 Free Software Foundation, Inc. | Copyright (C) 2006, 2011-2018 Free Software Foundation, Inc. |
| Written by Bruno Haible <bruno@clisp.org>, 2006. |
Written by Bruno Haible <bruno@clisp.org>, 2006. |
| |
|
| This program is free software: you can redistribute it and/or modify |
This program is free software: you can redistribute it and/or modify |
|
Line 13
|
Line 13
|
| GNU General Public License for more details. |
GNU General Public License for more details. |
| |
|
| You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License |
| along with this program. If not, see <http://www.gnu.org/licenses/>. */ | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
| |
|
| /* There are four ways to build shared libraries on Cygwin: |
/* There are four ways to build shared libraries on Cygwin: |
| |
|
|
Line 87
|
Line 87
|
| Note: --export-all-symbols is the default when no other symbol is explicitly |
Note: --export-all-symbols is the default when no other symbol is explicitly |
| exported. This means, the use of an explicit export on the variables has |
exported. This means, the use of an explicit export on the variables has |
| the effect of no longer exporting the functions! - until the option |
the effect of no longer exporting the functions! - until the option |
| --export-all-symbols is used. */ | --export-all-symbols is used. |
| |
|
| |
See <https://haible.de/bruno/woe32dll.html> for more details. */ |
| |
|
| |
#if defined __GNUC__ /* GCC compiler, GNU toolchain */ |
| |
|
| /* IMP(x) is a symbol that contains the address of x. */ |
/* IMP(x) is a symbol that contains the address of x. */ |
| #define IMP(x) _imp__##x | # define IMP(x) _imp__##x |
| |
|
| /* Ensure that the variable x is exported from the library, and that a |
/* Ensure that the variable x is exported from the library, and that a |
| pseudo-variable IMP(x) is available. */ |
pseudo-variable IMP(x) is available. */ |
| #define VARIABLE(x) \ | # define VARIABLE(x) \ |
| /* Export x without redefining x. This code was found by compiling a \ |
/* Export x without redefining x. This code was found by compiling a \ |
| snippet: \ |
snippet: \ |
| extern __declspec(dllexport) int x; int x = 42; */ \ |
extern __declspec(dllexport) int x; int x = 42; */ \ |
|
Line 104
|
Line 108
|
| /* Allocate a pseudo-variable IMP(x). */ \ |
/* Allocate a pseudo-variable IMP(x). */ \ |
| extern int x; \ |
extern int x; \ |
| void * IMP(x) = &x; |
void * IMP(x) = &x; |
| |
|
| |
#else /* non-GNU compiler, non-GNU toolchain */ |
| |
|
| |
# define VARIABLE(x) /* nothing */ |
| |
|
| |
#endif |