Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

/ray/src/lib/module/sharedobject.cc

Go to the documentation of this file.
00001 /*
00002  * lib/module/sharedobject.h
00003  * 
00004  * Implementing shared objects loadable at runtime (.so, .dll, ...)
00005  * 
00006  * Copyright (c) 2004 by Wolfgang Wieser ] wwieser (a) gmx <*> de [ 
00007  * 
00008  * This file may be distributed and/or modified under the terms of the 
00009  * GNU General Public License version 2 as published by the Free Software 
00010  * Foundation. (See COPYING.GPL for details.)
00011  * 
00012  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00013  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00014  * 
00015  */
00016 
00017 #include "sharedobject.h"
00018 #include "symbol.h"
00019 #include "pool.h"
00020 
00021 
00022 ModuleSymbol _ISharedObject::lookup(const char *symbol)
00023 {
00024     if(!this || !module)
00025     {  return ModuleSymbol();  }
00026     
00027     void *ptr;
00028     if(!g_module_symbol(module,symbol,&ptr)) ptr=NULL;
00029     if(!ptr)  return ModuleSymbol();
00030     
00031     return(ModuleSymbol(ptr,SharedObject(this)));
00032 }
00033 
00034 
00035 _ISharedObject::_ISharedObject(GModule *m,const char *_name) : 
00036     LinkedListBase<_ISharedObject>(),
00037     InternalRefNodeBase_ThreadSave(),
00038     module(m),
00039     mname(_name)
00040 {
00041     // empty
00042 }
00043 
00044 
00045 _ISharedObject::~_ISharedObject()
00046 {
00047     // ONLY those shared objects which actually have a module pointer 
00048     // may unregister; all others actually are not registered. 
00049     if(module)
00050     {  ModulePool::unregister(this);  }
00051 }

Generated on Sat Feb 19 22:33:45 2005 for Ray by doxygen 1.3.5