/** dlfunc wrappers
 * These function abstract dlopen,dlsym and dlclose for win32, OS-X, BeOS 
 * and POSIX etc.
 */
void *
CqPluginBase::DLOpen( CqString *library )
{
	void * handle = NULL;
	Aqsis::log() << info << "Loading plugin \"" << library->c_str() << "\"" << std::endl;

#ifndef AQSIS_NO_PLUGINS
#ifdef AQSIS_SYSTEM_WIN32

	handle = ( void* ) LoadLibrary( library->c_str() );
#else

	CqString tstring = *library;
	CqString::size_type pos = tstring.find ("/");
	if (pos == CqString::npos)
		tstring = CqString("./") + *library;
	handle = ( void * ) dlopen( tstring.c_str(), RTLD_NOW);
#endif
#endif // AQSIS_NO_PLUGINS

	if ( handle )
		m_activeHandles.push_back( handle );
	else
		/** \todo <b>Code Review</b>: Re-evaluate how the error handling works
		 * here.  For now we report the error, but perhaps it would be better
		 * to throw an exception and let the calling code handle the problem.
		 */
		Aqsis::log() << error << "Error loading plugin: \"" << DLError() << "\"\n";
	return handle;
}