bbtkDynamicLibraryHandling.h

Go to the documentation of this file.
00001 /*=========================================================================                                                                               
00002   Program:   bbtk
00003   Module:    $RCSfile: bbtkDynamicLibraryHandling.h,v $
00004   Language:  C++
00005   Date:      $Date: 2008/10/17 08:18:13 $
00006   Version:   $Revision: 1.2 $
00007 =========================================================================*/
00008 
00009 /* ---------------------------------------------------------------------
00010 
00011 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
00012 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
00013 *
00014 *  This software is governed by the CeCILL-B license under French law and 
00015 *  abiding by the rules of distribution of free software. You can  use, 
00016 *  modify and/ or redistribute the software under the terms of the CeCILL-B 
00017 *  license as circulated by CEA, CNRS and INRIA at the following URL 
00018 *  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
00019 *  or in the file LICENSE.txt.
00020 *
00021 *  As a counterpart to the access to the source code and  rights to copy,
00022 *  modify and redistribute granted by the license, users are provided only
00023 *  with a limited warranty  and the software's author,  the holder of the
00024 *  economic rights,  and the successive licensors  have only  limited
00025 *  liability. 
00026 *
00027 *  The fact that you are presently reading this means that you have had
00028 *  knowledge of the CeCILL-B license and that you accept its terms.
00029 * ------------------------------------------------------------------------ */                                                                         
00030 
00036 // System dependent includes for loading dynamic libraries
00037 #if defined(__GNUC__)
00038 // GCC compiler
00039 
00040 // dlopen, dlsym, etc.
00041 #include <dlfcn.h>
00042 
00043 // dlopen loading mode : 
00044 // instant/delayed symbol resolution
00045 #ifndef BBTK_RTLD_NOW
00046 #  define BBTK_RTLD_TIME RTLD_LAZY
00047 #else
00048 #  define BBTK_RTLD_TIME RTLD_NOW
00049 #endif
00050 // local/global symbol loading
00051 // one **MUST** use RTLD_GLOBAL in order to have 
00052 // the RTTI mechanism travel correctly across packages (typeid,dynamic_cast...)
00053 // however this can cause problems (symbol clashes) ...
00054 // see :
00055 // http://gcc.gnu.org/faq.html#dso
00056 // http://gcc.gnu.org/ml/gcc/2003-04/msg00256.html
00057 // http://gcc.gnu.org/ml/gcc-bugs/2003-10/msg02771.html
00058 #ifndef BBTK_RTLD_LOCAL
00059 #  define BBTK_RTLD_SCOPE RTLD_GLOBAL
00060 #else 
00061 #  define BBTK_RTLD_SCOPE RTLD_LOCAL
00062 #endif
00063 
00064 // dl handler type
00065 namespace bbtk 
00066 {
00067   typedef void* DynamicLibraryHandler;
00068 }
00069 
00070 #elif defined(_WIN32)
00071 // Win32
00072 // HINSTANCE, LoadLibrary, etc. definition
00073 #include "Windows.h"
00074 // dl handler type
00075 namespace bbtk 
00076 {
00077   typedef HINSTANCE DynamicLibraryHandler;
00078 }
00079 
00080 #else
00081 
00082 ERROR !! DYNAMIC LIBRARY LOADING NOT IMPLEMENTED FOR YOUR SYSTEM
00083 
00084 #endif

Generated on Wed Nov 12 11:37:08 2008 for BBTK by  doxygen 1.5.6