void newton_init(struct simulation *sim, char *solver_name)
{
	printf_log(sim, _("Solver initialization\n"));
	char lib_name[100];
	char lib_path[1000];
	sprintf(lib_name, "%s.so", solver_name);

	join_path(2, lib_path, get_plugins_path(sim), lib_name);
	printf_log(sim, "I want to open %s %s %s\n", lib_path,
		   get_plugins_path(sim), lib_name);

	char *error;

	dll_handle = dlopen(lib_path, RTLD_LAZY);

	if (!dll_handle) {
		fprintf(stderr, "%s\n", dlerror());
		exit(0);
	}

	dll_solve_cur = dlsym(dll_handle, "dll_solve_cur");
	if ((error = dlerror()) != NULL) {
		fprintf(stderr, "%s\n", error);
		exit(0);
	}

	dll_newton_set_min_ittr = dlsym(dll_handle, "dll_newton_set_min_ittr");
	if ((error = dlerror()) != NULL) {
		fprintf(stderr, "%s\n", error);
		exit(0);
	}

	dll_set_interface = dlsym(dll_handle, "set_interface");
	if ((error = dlerror()) != NULL) {
		fprintf(stderr, "%s\n", error);
		exit(0);
	}

	dll_solver_realloc = dlsym(dll_handle, "dll_solver_realloc");
	if ((error = dlerror()) != NULL) {
		fprintf(stderr, "%s\n", error);
		exit(0);
	}

	dll_solver_free_memory = dlsym(dll_handle, "dll_solver_free_memory");
	if ((error = dlerror()) != NULL) {
		fprintf(stderr, "%s\n", error);
		exit(0);
	}

	(*dll_newton_set_min_ittr) (0);

}
void cve_plugin_manager_init()
{
        DIR *dir = NULL;
        struct dirent *ent = NULL;
        autofree(char) *mod_path =NULL;

        if (_plugins) {
                return;
        }
        _plugins = cve_hashmap_new_full(string_hash, string_compare, NULL, (hash_free_func)destroy_plugin);

        mod_path = get_plugins_path();
        if (!mod_path) {
                fprintf(stderr, "Unable to determine module path\n");
                return;
        }

        if (!(dir = opendir(mod_path))) {
                fprintf(stderr, "Unable to list modules: %s\n", strerror(errno));
                return;
        }

        while ((ent = readdir(dir))) {
                if (g_str_has_suffix(ent->d_name, ".so")) {
                        load_module(ent->d_name);
                }
        }
        if (dir) {
                closedir(dir);
        }
}
static char *build_module_path(const char *name)
{
        autofree(char) *dir = get_plugins_path();
        char *p = NULL;

        if (!dir) {
                fprintf(stderr, "build_module_path(): Failed to determine module path!\n");
                return NULL;
        }

        if (!asprintf(&p, "%s/%s", dir, name)) {
                fprintf(stderr, "build_module_path(): Out of memory\n");
                return NULL;
        }

        return p;
}