Closed Bug 1131424 Opened 9 years ago Closed 9 years ago

Report error message when failing to open ctypes library

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla39
Tracking Status
firefox39 --- fixed

People

(Reporter: sfink, Assigned: sfink)

Details

Attachments

(1 file, 1 obsolete file)

It is very irritating to diagnose failures when opening a library. (In my case, it turned out to be because I still had an undefined symbol, because I needed to include additional object files in my link when I had a certain #define).
I'm not sure who pays attention to ctypes these days.
Attachment #8561804 - Flags: review?(jorendorff)
I suppose I ought to let you review the version that compiles.
Attachment #8562429 - Flags: review?(jorendorff)
Attachment #8561804 - Attachment is obsolete: true
Attachment #8561804 - Flags: review?(jorendorff)
Comment on attachment 8562429 [details] [diff] [review]
Report error message when failing to open ctypes library

Review of attachment 8562429 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/ctypes/Library.cpp
@@ +146,5 @@
>  
>    PRLibrary* library = PR_LoadLibraryWithFlags(libSpec, 0);
>  
>    if (!library) {
> +    char *error = (char*) js_malloc(PR_GetErrorTextLength() + 1);

I guess the usual allocation function to match JS_free is JS_malloc, but your call.

@@ +154,2 @@
>  #ifdef XP_WIN
> +    JS_ReportError(cx, "couldn't open library %hs: %s", pathChars, error);

All right, %s is nullsafe...
Attachment #8562429 - Flags: review?(jorendorff) → review+
https://hg.mozilla.org/mozilla-central/rev/0320992e5b37
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
You need to log in before you can comment on or make changes to this bug.