+ std::string descriptors = f( );
+
+ // Demangle descriptors
+ TFilters filters;
+ std::replace( descriptors.begin( ), descriptors.end( ), ';', ' ' );
+ std::istringstream str( descriptors );
+ while( str )
+ {
+ std::string value, category, name;
+ str >> value;
+ if( value == "" )
+ continue;
+ std::replace( value.begin( ), value.end( ), ':', ' ' );
+ std::istringstream value_str( value );
+ value_str >> category >> name;
+ filters[ category ].insert( name );
+
+ } // elihw
+ return( filters );
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::Interface::
+TCreator cpPlugins::Interface::
+_DLGetCreator(
+ void* hnd, const std::string& category, const std::string& name
+ )
+{
+ TCreator c = NULL;
+ std::string func_name = category + "_" + name;
+#ifdef cpPlugins_SYS_WINDOWS
+ c = ( TCreator )( ::GetProcAddress( ( HMODULE )hnd, func_name.c_str( ) ) );
+#else // cpPlugins_SYS_WINDOWS
+ c = ( TCreator )( dlsym( hnd, func_name.c_str( ) ) );
+#endif // cpPlugins_SYS_WINDOWS
+ if( c == NULL )
+ throw std::runtime_error(
+ std::string( "cpPlugins::Interface: Class \"" ) +
+ category + std::string( ":" ) + name +
+ std::string( "\" does not have a valid creator function." )
+ );
+ return( c );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::
+_DLClose( void* hnd )
+{
+#ifdef cpPlugins_SYS_WINDOWS
+ ::FreeLibrary( ( HMODULE )hnd );
+#else // cpPlugins_SYS_WINDOWS
+ dlclose( hnd );
+#endif // cpPlugins_SYS_WINDOWS