os_dlfcn.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    os_dlfcn.h
00006  *
00007  *  dynamic linking
00008  *
00009  *  os_dlfcn.h,v 1.9 2006/05/30 11:08:47 jwillemsen Exp
00010  *
00011  *  @author Don Hinton <dhinton@dresystems.com>
00012  *  @author This code was originally in various places including ace/OS.h.
00013  */
00014 //=============================================================================
00015 
00016 #ifndef ACE_OS_INCLUDE_OS_DLFCN_H
00017 #define ACE_OS_INCLUDE_OS_DLFCN_H
00018 
00019 #include /**/ "ace/pre.h"
00020 
00021 #include "ace/config-all.h"
00022 
00023 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00024 # pragma once
00025 #endif /* ACE_LACKS_PRAGMA_ONCE */
00026 
00027 #if !defined (ACE_LACKS_DLFCN_H)
00028 #  if defined (ACE_HAS_DLFCN_H_BROKEN_EXTERN_C)
00029      extern "C" {
00030 #  endif /* ACE_HAS_DLFCN_H_BROKEN_EXTERN_C */
00031 #  include /**/ <dlfcn.h>
00032 #  if defined (ACE_HAS_DLFCN_H_BROKEN_EXTERN_C)
00033      }
00034 #  endif /* ACE_HAS_DLFCN_H_BROKEN_EXTERN_C */
00035 #endif /* !ACE_LACKS_DLFCN_H */
00036 
00037 #if defined (__hpux)
00038 #  if defined(__GNUC__) || __cplusplus >= 199707L
00039 #    include /**/ <dl.h>
00040 #  else
00041 #    include /**/ <cxxdl.h>
00042 #  endif /* (g++ || HP aC++) vs. HP C++ */
00043 #endif /* __hpux */
00044 
00045 #if defined (ACE_VXWORKS) && !defined (__RTP__)
00046 #  include /**/ <loadLib.h> /* for module load */
00047 #  include /**/ <unldLib.h> /* for module unload */
00048 #  include /**/ <symLib.h> /* for findSymbol  */
00049 #  include /**/ <sysSymTbl.h> /* for global symbol table */
00050 #endif /* ACE_VXWORKS */
00051 
00052 // Place all additions (especially function declarations) within extern "C" {}
00053 #ifdef __cplusplus
00054 extern "C"
00055 {
00056 #endif /* __cplusplus */
00057 
00058 #if defined (_M_UNIX)
00059   int _dlclose (void *);
00060   char *_dlerror (void);
00061   void *_dlopen (const char *, int);
00062   void * _dlsym (void *, const char *);
00063 #endif /* _M_UNIX */
00064 
00065 /* Set the proper handle type for dynamically-loaded libraries. */
00066 /* Also define a default 'mode' for loading a library - the names and values */
00067 /* differ between OSes, so if you write code that uses the mode, be careful */
00068 /* of the platform differences. */
00069 #if defined (ACE_WIN32)
00070    // Dynamic loading-related types - used for dlopen and family.
00071    typedef HINSTANCE ACE_SHLIB_HANDLE;
00072 #  define ACE_SHLIB_INVALID_HANDLE 0
00073 #  define ACE_DEFAULT_SHLIB_MODE 0
00074 #elif defined (ACE_HAS_SVR4_DYNAMIC_LINKING)
00075    typedef void *ACE_SHLIB_HANDLE;
00076 #  define ACE_SHLIB_INVALID_HANDLE 0
00077    // This is needed to for dynamic_cast to work properly on objects passed to
00078    // libraries.
00079 #  define ACE_DEFAULT_SHLIB_MODE RTLD_LAZY | RTLD_GLOBAL
00080 #elif defined (__hpux)
00081    typedef shl_t ACE_SHLIB_HANDLE;
00082 #  define ACE_SHLIB_INVALID_HANDLE 0
00083 #  define ACE_DEFAULT_SHLIB_MODE BIND_DEFERRED
00084 #else /* !ACE_WIN32 && !ACE_HAS_SVR4_DYNAMIC_LINKING && !__hpux */
00085    typedef void *ACE_SHLIB_HANDLE;
00086 #  define ACE_SHLIB_INVALID_HANDLE 0
00087 #  define ACE_DEFAULT_SHLIB_MODE RTLD_LAZY
00088 #endif /* ACE_WIN32 */
00089 
00090 #if !defined (RTLD_LAZY)
00091 #define RTLD_LAZY 1
00092 #endif /* !RTLD_LAZY */
00093 
00094 #if !defined (RTLD_NOW)
00095 #define RTLD_NOW 2
00096 #endif /* !RTLD_NOW */
00097 
00098 #if !defined (RTLD_GLOBAL)
00099 #define RTLD_GLOBAL 3
00100 #endif /* !RTLD_GLOBAL */
00101 
00102 #ifdef __cplusplus
00103 }
00104 #endif /* __cplusplus */
00105 
00106 #include /**/ "ace/post.h"
00107 #endif /* ACE_OS_INCLUDE_OS_DLFCN_H */

Generated on Thu Nov 9 09:41:57 2006 for ACE by doxygen 1.3.6