From: Carl Worth Date: Thu, 22 Aug 2013 00:32:35 +0000 (-0700) Subject: Add a more useful error message if dlopen fails X-Git-Url: https://git.cworth.org/git?p=glaze;a=commitdiff_plain;h=2b7630a8f3277a568695fc59996c8bad34261454;hp=553d330d06573b6bc951e3c00672a1abfe29b7aa Add a more useful error message if dlopen fails Previously, we were printing only the name of the library that we failed to open. Now, we also print the underlying cause for the failure, (as reported by dlerror). --- diff --git a/glaze-gl.c b/glaze-gl.c index 0c2eada..b6e7d72 100644 --- a/glaze-gl.c +++ b/glaze-gl.c @@ -63,9 +63,11 @@ open_wrapper_handle (void) exit (1); } + dlerror (); wrapper_handle = dlopen (path, RTLD_LAZY); if (wrapper_handle == NULL) { - fprintf (stderr, "Error: Failed to dlopen %s\n", path); + const char *error = dlerror(); + fprintf (stderr, "Error: Failed to dlopen %s: %s\n", path, error); exit (1); } }