public static synchronized void loadLibrary(String name)
	{
		if(loadedLibraries.contains(name))
			return;

		// find implementation for given library name
		LibraryImplementation libImpl = null;
		if(libSet != null)
			libImpl = libSet.findImplementation(name);

		// if there is none, try to load library the 'normal' way
		if(libImpl==null){
			loadDefaultLibrary(name);
			return;
		}

		String prefix = PRODUCTNAME + "-nativelib-v-" + VERSION_MAJOR + '-' + VERSION_MINOR + '-' ;
		String suffix = stripPathFromResourceName(libImpl.libraryResource);

		boolean loaded = false;

		try {
			// try default (shared) library name first
			File parentDir = new File(System.getProperty("java.io.tmpdir"));
			extractAndLoadLibrary(libImpl, new File(parentDir, prefix + suffix));
			loaded = true;
		} catch(Throwable t) {
			t.printStackTrace();
		}

		if(!loaded){
			try {
				// if something went wrong, try temporary file
				File tmpLibFile = File.createTempFile(prefix, suffix);
				extractAndLoadLibrary(libImpl, tmpLibFile);
				loaded = true;
			} catch(Throwable t){
				t.printStackTrace();
			}
		}

		// if all else fails, try System.loadLibrary();
		if(!loaded) {
			try {
				loadDefaultLibrary(name);
				loaded = true;
			}catch(Throwable t){
				t.printStackTrace();
			}
		}

		if(loaded)
			loadedLibraries.add(name);
	}