Check null last_slash.  Don't add prefix lib for Windows.
@@ -156,8 +156,10 @@ static void *open_lib (const char *dir, const char *name) {
VARR_TRUNC (char, temp_string, 0);
VARR_PUSH_ARR (char, temp_string, dir, strlen (dir));
- if (last_slash[1] != '\0') VARR_PUSH (char, temp_string, slash);
+ if (last_slash == NULL || last_slash[1] != '\0') VARR_PUSH (char, temp_string, slash);
+#ifndef _WIN32
VARR_PUSH_ARR (char, temp_string, "lib", 3);
+#endif
VARR_PUSH_ARR (char, temp_string, name, strlen (name));
VARR_PUSH_ARR (char, temp_string, lib_suffix, strlen (lib_suffix));
VARR_PUSH (char, temp_string, 0);
