Open
Bug 533014
Opened 15 years ago
Updated 2 years ago
Patches for using NSPR as static libraries
Categories
(NSPR :: NSPR, enhancement)
NSPR
NSPR
Tracking
(Not tracked)
NEW
People
(Reporter: wtc, Unassigned)
References
Details
Attachments
(1 file, 4 obsolete files)
I'm using this bug report to publish patches that enable using NSPR as static libraries. WARNING: If a process has two copies of NSPR, and an application is not careful in isolating the copies of NSPR (for example, passing a memory block allocated by PR_Malloc of one copy of NSPR to PR_Free of another copy of NSPR, or calling PR_GetError() of one copy of NSPR after an NSPR function in another copy of NSPR failed), things won't work. The best way to ensure a process has only one copy of NSPR is to use NSPR shared libraries (DLLs). The only feature of shared libraries/DLLs that NSPR depends on is the DllMain DLL_THREAD_DETACH notification that NSPR uses to detach native threads not created by NSPR. So I worked on Windows first. The attached patch allows me to build NSPR static libraries properly, and pass all the NSPR test programs. The key changes are: 1. In prtypes.h, I have to disable the PR_EXPORT, PR_IMPORT, and PR_IMPLEMENT macros because they cause NSPR public functions to be exported from a DLL or EXE on Windows. This change requires changes to mozilla/nsprpub/pr/tests/dll to export symbols from the test DLL using a .def file. 2. In w95thred.c, I found an alternative solution for detaching native threads not created by NSPR. All the other changes are build system changes (to not build the DLls) and test changes (to disable tests that are applicable to DLLs only). Some of these changes are generally useful (e.g., the alternative to DllMain). I will have them reviewed and checked in to reduce the size of this patch.
Reporter | ||
Comment 1•15 years ago
|
||
Add 'extern' to PR_IMPORT and PR_IMPORT_DATA in prtypes.h.
Attachment #416182 -
Attachment is obsolete: true
Reporter | ||
Comment 2•14 years ago
|
||
Change mozilla/nsprpub/pr/tests/Makefile.in to link with -framework CoreServices -framework CoreFoundation on the Mac.
Attachment #421738 -
Attachment is obsolete: true
Reporter | ||
Comment 3•14 years ago
|
||
Updated the patch for NSPR 4.8.6. The thread local storage (TLS) callback code in mozilla/nsprpub/pr/src/md/windows/w95thred.c was updated to survive whole program optimization.
Attachment #447401 -
Attachment is obsolete: true
Reporter | ||
Comment 4•14 years ago
|
||
Improved the comments. No other changes.
Attachment #464248 -
Attachment is obsolete: true
Comment 5•2 years ago
|
||
The bug assignee is inactive on Bugzilla, so the assignee is being reset.
Assignee: wtc → nobody
Status: ASSIGNED → NEW
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•