#include "DefOrgViewerAdapterDynamicLoader.h" using namespace itk; namespace mial{ typedef DefOrgViewerAdapterBase* (* DEFORG_LOAD_FUNCTION)(); DefOrgViewerAdapterBase* DefOrgViewerAdapterDynamicLoader::LoadLibrary(char* path){ m_lib = DynamicLoader::OpenLibrary(path); DefOrgViewerAdapterBase* toReturn = NULL; if ( m_lib ){ //Look for the symbol itkLoad in the library DEFORG_LOAD_FUNCTION loadfunction = (DEFORG_LOAD_FUNCTION)DynamicLoader::GetSymbolAddress(m_lib, "defOrgLoad"); //if the symbol is found call it to create the factory from the library if ( loadfunction ){ DefOrgViewerAdapterBase* newDefOrg = (*loadfunction)(); toReturn = newDefOrg; } } return toReturn; } DefOrgViewerAdapterDynamicLoader::~DefOrgViewerAdapterDynamicLoader(){ DynamicLoader::CloseLibrary((LibHandle)m_lib); } }