root/libltdl/libltdl/lt__private.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /* lt__private.h -- internal apis for libltdl
   2 
   3    Copyright (C) 2004-2008, 2011-2019, 2021-2022 Free Software
   4    Foundation, Inc.
   5    Written by Gary V. Vaughan, 2004
   6 
   7    NOTE: The canonical source of this file is maintained with the
   8    GNU Libtool package.  Report bugs to bug-libtool@gnu.org.
   9 
  10 This library is free software; you can redistribute it and/or
  11 modify it under the terms of the GNU Lesser General Public
  12 License as published by the Free Software Foundation; either
  13 version 2 of the License, or (at your option) any later version.
  14 
  15 As a special exception to the GNU Lesser General Public License,
  16 if you distribute this file as part of a program or library that
  17 is built using GNU libtool, you may include this file under the
  18 same distribution terms that you use for the rest of that program.
  19 
  20 GNU Libltdl is distributed in the hope that it will be useful,
  21 but WITHOUT ANY WARRANTY; without even the implied warranty of
  22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  23 GNU Lesser General Public License for more details.
  24 
  25 You should have received a copy of the GNU Lesser General Public
  26 License along with GNU Libltdl; see the file COPYING.LIB.  If not, a
  27 copy con be downloaded from http://www.gnu.org/licenses/lgpl.html,
  28 or obtained by writing to the Free Software Foundation, Inc.,
  29 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
  30 */
  31 
  32 #if !defined LT__PRIVATE_H
  33 #define LT__PRIVATE_H 1
  34 
  35 #if defined LT_CONFIG_H
  36 #  include LT_CONFIG_H
  37 #else
  38 #  include <config.h>
  39 #endif
  40 
  41 #include <stdio.h>
  42 #include <ctype.h>
  43 #include <assert.h>
  44 #include <errno.h>
  45 #include <string.h>
  46 
  47 #if defined HAVE_UNISTD_H
  48 #  include <unistd.h>
  49 #endif
  50 
  51 /* Import internal interfaces...  */
  52 #include "lt__alloc.h"
  53 #include "lt__dirent.h"
  54 #include "lt__strl.h"
  55 #include "lt__glibc.h"
  56 
  57 /* ...and all exported interfaces.  */
  58 #include "ltdl.h"
  59 
  60 #if defined WITH_DMALLOC
  61 #  include <dmalloc.h>
  62 #endif
  63 
  64 /* DLL building support on win32 hosts;  mostly to workaround their
  65    ridiculous implementation of data symbol exporting. */
  66 #ifndef LT_GLOBAL_DATA
  67 # if defined __WINDOWS__ || defined __CYGWIN__
  68 #  if defined DLL_EXPORT        /* defined by libtool (if required) */
  69 #   define LT_GLOBAL_DATA       __declspec(dllexport)
  70 #  endif
  71 # endif
  72 # ifndef LT_GLOBAL_DATA
  73 #  define LT_GLOBAL_DATA        /* static linking or !__WINDOWS__ */
  74 # endif
  75 #endif
  76 
  77 #ifndef __attribute__
  78 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__
  79 #  define __attribute__(x)
  80 # endif
  81 #endif
  82 
  83 #ifndef LT__UNUSED
  84 # define LT__UNUSED __attribute__ ((__unused__))
  85 #endif
  86 
  87 
  88 LT_BEGIN_C_DECLS
  89 
  90 #if !defined errno
  91 extern int errno;
  92 #endif
  93 
  94 LT_SCOPE void   lt__alloc_die_callback (void);
  95 
  96 
  97 /* For readability:  */
  98 #define STRNEQ(s1, s2)  (strcmp((s1), (s2)) != 0)
  99 #define STREQ(s1, s2)   (strcmp((s1), (s2)) == 0)
 100 
 101 
 102 
 103 /* --- OPAQUE STRUCTURES DECLARED IN LTDL.H --- */
 104 
 105 /* This type is used for the array of interface data sets in each handler. */
 106 typedef struct {
 107   lt_dlinterface_id     key;
 108   void *                data;
 109 } lt_interface_data;
 110 
 111 struct lt__handle {
 112   lt_dlhandle           next;
 113   const lt_dlvtable *   vtable;         /* dlopening interface */
 114   lt_dlinfo             info;           /* user visible fields */
 115   int                   depcount;       /* number of dependencies */
 116   lt_dlhandle *         deplibs;        /* dependencies */
 117   lt_module             module;         /* system module handle */
 118   void *                system;         /* system specific data */
 119   lt_interface_data *   interface_data; /* per caller associated data */
 120   int                   flags;          /* various boolean stats */
 121 };
 122 
 123 struct lt__advise {
 124   unsigned int  try_ext:1;      /* try system library extensions.  */
 125   unsigned int  is_resident:1;  /* module can't be unloaded. */
 126   unsigned int  is_symglobal:1; /* module symbols can satisfy
 127                                    subsequently loaded modules.  */
 128   unsigned int  is_symlocal:1;  /* module symbols are only available
 129                                    locally. */
 130   unsigned int  try_preload_only:1;/* only preloaded modules will be tried. */
 131 };
 132 
 133 /* --- ERROR HANDLING --- */
 134 
 135 /* Extract the diagnostic strings from the error table macro in the same
 136    order as the enumerated indices in lt_error.h. */
 137 
 138 #define LT__STRERROR(name)      lt__error_string(LT_CONC(LT_ERROR_,name))
 139 
 140 #define LT__GETERROR(lvalue)          (lvalue) = lt__get_last_error()
 141 #define LT__SETERRORSTR(errormsg)     lt__set_last_error(errormsg)
 142 #define LT__SETERROR(errorcode)       LT__SETERRORSTR(LT__STRERROR(errorcode))
 143 
 144 LT_SCOPE const char *lt__error_string   (int errorcode);
 145 LT_SCOPE const char *lt__get_last_error (void);
 146 LT_SCOPE const char *lt__set_last_error (const char *errormsg);
 147 
 148 LT_END_C_DECLS
 149 
 150 #endif /*!defined LT__PRIVATE_H*/

/* [previous][next][first][last][top][bottom][index][help] */