diff options
Diffstat (limited to 'lib/relocatable.h')
| -rw-r--r-- | lib/relocatable.h | 34 | 
1 files changed, 26 insertions, 8 deletions
diff --git a/lib/relocatable.h b/lib/relocatable.h index 49452fe7..162f9d82 100644 --- a/lib/relocatable.h +++ b/lib/relocatable.h @@ -1,5 +1,5 @@  /* Provide relocatable packages. -   Copyright (C) 2003, 2005, 2008-2022 Free Software Foundation, Inc. +   Copyright (C) 2003, 2005, 2008-2024 Free Software Foundation, Inc.     Written by Bruno Haible <bruno@clisp.org>, 2003.     This file is free software: you can redistribute it and/or modify @@ -18,6 +18,11 @@  #ifndef _RELOCATABLE_H  #define _RELOCATABLE_H +/* This file uses _GL_ATTRIBUTE_MALLOC, HAVE_VISIBILITY.  */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif +  #include <stdlib.h>  #ifdef __cplusplus @@ -28,15 +33,28 @@ extern "C" {  /* This can be enabled through the configure --enable-relocatable option.  */  #if ENABLE_RELOCATABLE -/* When building a DLL, we must export some functions.  Note that because -   this is a private .h file, we don't need to use __declspec(dllimport) -   in any case.  */ +/* When building a shared library, we must export some functions. +   Note that because this is a private .h file, we don't need to use +   __declspec(dllimport) in any case.  */  #if HAVE_VISIBILITY && BUILDING_DLL -# define RELOCATABLE_DLL_EXPORTED __attribute__((__visibility__("default"))) +# define RELOCATABLE_SHLIB_EXPORTED __attribute__((__visibility__("default")))  #elif defined _MSC_VER && BUILDING_DLL -# define RELOCATABLE_DLL_EXPORTED __declspec(dllexport) +/* When building with MSVC, exporting a symbol means that the object file +   contains a "linker directive" of the form /EXPORT:symbol.  This can be +   inspected through the "objdump -s --section=.drectve FILE" or +   "dumpbin /directives FILE" commands. +   The symbols from this file should be exported if and only if the object +   file gets included in a DLL.  Libtool, on Windows platforms, defines +   the C macro DLL_EXPORT (together with PIC) when compiling for a shared +   library (called DLL under Windows) and does not define it when compiling +   an object file meant to be linked statically into some executable.  */ +# if defined DLL_EXPORT +#  define RELOCATABLE_SHLIB_EXPORTED __declspec(dllexport) +# else +#  define RELOCATABLE_SHLIB_EXPORTED +# endif  #else -# define RELOCATABLE_DLL_EXPORTED +# define RELOCATABLE_SHLIB_EXPORTED  #endif  /* Sets the original and the current installation prefix of the package. @@ -44,7 +62,7 @@ extern "C" {     by the corresponding pathname with the current prefix instead.  Both     prefixes should be directory names without trailing slash (i.e. use ""     instead of "/").  */ -extern RELOCATABLE_DLL_EXPORTED void +extern RELOCATABLE_SHLIB_EXPORTED void         set_relocation_prefix (const char *orig_prefix,                                const char *curr_prefix);  | 
