C:/cmcintos/defOrgs/examples/DefOrgViewerWithKW/Source/DefOrgViewerAdapterDynamicLoader.cxx

00001 #include "DefOrgViewerAdapterDynamicLoader.h"
00002 using namespace itk;
00003 namespace mial{
00004 typedef DefOrgViewerAdapterBase* (* DEFORG_LOAD_FUNCTION)();
00005 
00006 DefOrgViewerAdapterBase* DefOrgViewerAdapterDynamicLoader::LoadLibrary(char* path){
00007         m_lib = DynamicLoader::OpenLibrary(path);
00008         DefOrgViewerAdapterBase* toReturn = NULL;
00009     if ( m_lib ){
00010         //Look for the symbol itkLoad in the library
00011         DEFORG_LOAD_FUNCTION loadfunction
00012           = (DEFORG_LOAD_FUNCTION)DynamicLoader::GetSymbolAddress(m_lib, "defOrgLoad");
00013         //if the symbol is found call it to create the factory from the library
00014         if ( loadfunction ){
00015           DefOrgViewerAdapterBase* newDefOrg = (*loadfunction)();
00016                   toReturn = newDefOrg;
00017                 }
00018         }
00019         return toReturn;
00020 }
00021 
00022 
00023 DefOrgViewerAdapterDynamicLoader::~DefOrgViewerAdapterDynamicLoader(){
00024         DynamicLoader::CloseLibrary((LibHandle)m_lib);
00025 
00026 }
00027 }

Generated on Wed Jul 19 13:05:16 2006 for IDO by  doxygen 1.4.7