diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2022-03-23 12:34:26 +0800 |
---|---|---|
committer | Joe Orton <jorton@apache.org> | 2022-03-24 13:40:10 +0000 |
commit | fb99192806e80ddcba852d7701c3cea9b7ae09cb (patch) | |
tree | 9fc2ed28fbf236def84b99cc2ade959865c725d4 | |
parent | 2ed24b935eea6ccc81bb6fabbc8b4dc904f77184 (diff) | |
download | neon-git-fb99192806e80ddcba852d7701c3cea9b7ae09cb.tar.gz |
ne_defs.h: Add NE_VAR macro
This adds a macro to decorate public variables that is defined as 'extern' when
building on non-Visual Studio compilers or when libneon is built statically.
However when libneon is built or used as a shared (DLL) build, the macro will
be defined to be 'extern __declspec(dllexport)' and
'extern __declspec(dllimport)' so that the variables are correctly exported and
imported from the DLL during linking.
-rw-r--r-- | src/ne_defs.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/ne_defs.h b/src/ne_defs.h index b93eff3..d32ea5f 100644 --- a/src/ne_defs.h +++ b/src/ne_defs.h @@ -88,4 +88,16 @@ typedef off_t ne_off_t; #define NE_BUFSIZ 8192 #endif +#ifndef NE_VAR +# if defined(_MSC_VER) && defined(NE_DLL) +# ifdef BUILDING_NEON +# define NE_VAR extern __declspec(dllexport) +# else +# define NE_VAR extern __declspec(dllimport) +# endif +# else +# define NE_VAR extern +# endif +#endif + #endif /* NE_DEFS_H */ |