Firefox Source Docs Logo

Quick search

Overview

  • A Glossary of Common Terms
  • A Quick Guide to Mozilla Applications

Getting Started

  • Getting Set Up To Work On The Firefox Codebase

Working On Firefox

  • Working on Firefox
  • Bug Handling
  • Firefox Crash Reporting

Firefox User Guide

  • 3D view
  • about:debugging
  • Accessibility Inspector
  • Application
  • Browser Console
  • Browser Toolbox
  • Custom Formatters
  • The Firefox JavaScript Debugger
  • Debugger-API
  • Deprecated tools
  • DevTools API
  • DevToolsColors
  • DOM Property Viewer
  • Eyedropper
  • Index
  • JavaScript Tracer
  • JSON viewer
  • All keyboard shortcuts
  • Local Mode
  • Measure a portion of the page
  • Memory
  • Migrating from Firebug
  • Network Monitor
  • Page Inspector
  • Performance Tool
  • Responsive Design Mode
  • Rulers
  • Settings
  • Shader Editor
  • Storage Inspector
  • Style Editor
  • Taking screenshots
  • Tips
  • Toolbox
  • Validators
  • View Source
  • Web Audio Editor
  • Web Console
  • Working with iframes
  • Firefox DevTools User Docs

Source Code Documentation

  • Governance
  • Firefox Front-end
  • DOM
  • Editor
  • Style system (CSS) & Layout
  • Graphics
  • Processes, Threads and IPC
  • Getting started
  • Architecture overview
  • Contributing
  • Bugs and issues
  • Firefox DevTools Contributor Docs
  • Toolkit
  • SpiderMonkey
  • JS Loader
  • GeckoView
  • Fenix
  • Focus for Android
  • WebIDL
  • libpref
  • Networking
  • Remote Protocols
  • Services
  • Permissions
  • File Handling
  • Firefox on macOS
  • Firefox on Windows
  • Firefox AI Runtime
  • Accessibility
  • Media Playback
  • Code quality
  • Writing Rust Code
  • Rust Components
  • Gecko Profiler
  • Performance
  • Database bindings (SQLite, KV, …)
  • XPCOM
  • NSPR
    • Documentation
    • Getting NSPR
    • Community
    • Related Topics
      • NSPR listing
        • About NSPR
        • Creating a cookie log
        • PR_Poll() and the layered I/O
        • Nonblocking IO in NSPR
        • Non-blocking layered I/O
        • NSPR build instructions
        • NSPR contributor guide
        • NSPR pool method
        • NSPR release procedure
        • NSPR’s position on abrupt thread termination
        • Optimizing applications for NSPR
        • NSPR platforms
        • Process forking in NSPR
        • Running NSPR tests
        • NSPR IO on NT
        • IO Timeout and Interrupt
        • Canceling Overlapped IO by Closing the File Descriptor
        • Limitations
        • Conclusions
        • Original Document Information
        • Anonymous Shared Memory
        • Atomic Operations Functions
        • Important
        • Cached Monitors Functions
        • Condition Variable Type
        • Condition Variable Functions
        • Macros for Time Unit Conversion
        • Types and Constants
        • Time Parameter Callback Functions
        • Functions
        • Dynamic Library Search
        • References
        • Hash Table Types and Constants
        • Hash Table Functions
        • I/O functions
        • Directory Type
        • File Descriptor Types
        • File Info Types
        • Network Address Types
        • Types Used with Socket Options Functions
        • Type Used with Memory-Mapped I/O
        • Offset Interpretation for Seek Functions
        • NSPR API Reference
        • Interval Time Type and Constants
        • Interval Functions
        • Introduction to NSPR
        • IPC Semaphore Functions
        • Linked List Types
        • Linked List Macros
        • Lock Type
        • Lock Functions
        • NSPR Logging
        • Long Long integers
        • Memory Allocation Functions
        • Memory Allocation Macros
        • Monitor Type
        • Monitor Functions
        • Shared Memory Protocol
        • Named Shared Memory Functions
        • Network Address Types and Constants
        • Network address functions
        • Error Type
        • Error Functions
        • Error Codes
        • NSPR_LOG_FILE
        • NSPR_LOG_MODULES
        • Calling Convention Types
        • Algebraic Types
        • Miscellaneous Types
        • PL_CompareStrings
        • PL_CompareValues
        • PL_HashString
        • PL_HashTableAdd
        • PL_HashTableDestroy
        • PL_HashTableEnumerateEntries
        • PL_HashTableLookup
        • PL_HashTableRemove
        • PL_NewHashTable
        • PL_strcpy
        • PL_strdup
        • PL_strfree
        • PL_strlen
        • PLHashAllocOps
        • PLHashComparator
        • PLHashEntry
        • PLHashEnumerator
        • PLHashFunction
        • PLHashNumber
        • PLHashTable
        • PR_Abort
        • PR_Accept
        • PR_AcceptRead
        • PR_Access
        • PR_APPEND_LINK
        • PR_ASSERT
        • PR_AtomicAdd
        • PR_AtomicDecrement
        • PR_AtomicIncrement
        • PR_AtomicSet
        • PR_AttachSharedMemory
        • PR_AttachThread
        • PR_Available
        • PR_Available64
        • PR_Bind
        • PR_BlockClockInterrupts
        • PR_CALLBACKimplementation
        • PR_Calloc
        • PR_CallOnce
        • PR_CancelJob
        • PR_CEnterMonitor
        • PR_CExitMonitor
        • PR_Cleanup
        • PR_ClearInterrupt
        • PR_CLIST_IS_EMPTY
        • PR_Close
        • PR_CloseDir
        • PR_CloseFileMap
        • PR_CloseSemaphore
        • PR_CloseSharedMemory
        • PR_CNotify
        • PR_CNotifyAll
        • PR_cnvtf
        • PR_Connect
        • PR_ConnectContinue
        • PR_ConvertIPv4AddrToIPv6
        • PR_CreateFileMap
        • PR_CreateIOLayerStub
        • PR_CreatePipe
        • PR_CreateThread
        • PR_CreateThreadPool
        • PR_CWait
        • PR_Delete
        • PR_DELETE (Deprecated)
        • PR_DeleteSemaphore
        • PR_DeleteSharedMemory
        • PR_DestroyCondVar
        • PR_DestroyLock
        • PR_DestroyMonitor
        • PR_DestroyPollableEvent
        • PR_DetachSharedMemory
        • PR_DetachThread
        • PR_DisableClockInterrupts
        • PR_dtoa
        • PR_EnterMonitor
        • PR_EnumerateAddrInfo
        • PR_EnumerateHostEnt
        • PR_ExitMonitor
        • PR_ExplodeTime
        • PR_ExportFileMapAsString
        • PR_EXTERN
        • PR_FamilyInet
        • PR_FindSymbol
        • PR_FindSymbolAndLibrary
        • PR_Free
        • PR_FreeAddrInfo
        • PR_FREEIF
        • PR_FreeLibraryName
        • PR_GetAddrInfoByName
        • PR_GetCanonNameFromAddrInfo
        • PR_GetConnectStatus
        • PR_GetCurrentThread
        • PR_GetDefaultIOMethods
        • PR_GetDescType
        • PR_GetError
        • PR_GetErrorText
        • PR_GetErrorTextLength
        • PR_GetFileInfo
        • PR_GetFileInfo64
        • PR_GetHostByAddr
        • PR_GetHostByName
        • PR_GetIdentitiesLayer
        • PR_GetInheritedFileMap
        • PR_GetLayersIdentity
        • PR_GetLibraryName
        • PR_GetLibraryPath
        • PR_GetNameForIdentity
        • PR_GetOpenFileInfo
        • PR_GetOpenFileInfo64
        • PR_GetOSError
        • PR_GetPeerName
        • PR_GetProtoByName
        • PR_GetProtoByNumber
        • PR_GetRandomNoise
        • PR_GetSocketOption
        • PR_GetSockName
        • PR_GetSpecialFD
        • PR_GetThreadPriority
        • PR_GetThreadPrivate
        • PR_GetThreadScope
        • PR_GetUniqueIdentity
        • PR_GMTParameters
        • PR_htonl
        • PR_htons
        • PR_IMPLEMENT
        • PR_ImplodeTime
        • PR_ImportFileMapFromString
        • PR_ImportTCPSocket
        • PR_Init
        • PR_INIT_CLIST
        • PR_INIT_STATIC_CLIST
        • PR_Initialize
        • PR_Initialized
        • PR_InitializeNetAddr
        • PR_INSERT_AFTER
        • PR_INSERT_BEFORE
        • PR_INSERT_LINK
        • PR_Interrupt
        • PR_IntervalNow
        • PR_IntervalToMicroseconds
        • PR_IntervalToMilliseconds
        • PR_IntervalToSeconds
        • PR_JoinJob
        • PR_JoinThread
        • PR_JoinThreadPool
        • PR_LIST_HEAD
        • PR_LIST_TAIL
        • PR_Listen
        • PR_LoadLibrary
        • PR_LocalTimeParameters
        • PR_Lock
        • PR_MALLOC
        • PR_MemMap
        • PR_MicrosecondsToInterval
        • PR_MillisecondsToInterval
        • PR_MkDir
        • PR_MSEC_PER_SEC
        • PR_NAME
        • PR_NetAddrToString
        • PR_NETDB_BUF_SIZE
        • PR_NEW
        • PR_NewCondVar
        • PR_NewLock
        • PR_NewMonitor
        • PR_NewPollableEvent
        • PR_NewProcessAttr
        • PR_NewTCPSocket
        • PR_NewThreadPrivateIndex
        • PR_NewUDPSocket
        • PR_NEWZAP
        • PR_NEXT_LINK
        • PR_NormalizeTime
        • PR_Notify
        • PR_NotifyAll
        • PR_NotifyAllCondVar
        • PR_NotifyCondVar
        • PR_Now
        • PR_NSEC_PER_MSEC
        • PR_NSEC_PER_SEC
        • PR_ntohl
        • PR_ntohs
        • PR_Open
        • PR_OpenAnonFileMap
        • PR_OpenDir
        • PR_OpenSemaphore
        • PR_OpenSharedMemory
        • PR_OpenTCPSocket
        • PR_OpenUDPSocket
        • PR_Poll
        • PR_PopIOLayer
        • PR_PostSemaphore
        • PR_PREV_LINK
        • PR_ProcessAttrSetInheritableFileMap
        • PR_ProcessExit
        • PR_PushIOLayer
        • PR_QueueJob
        • PR_QueueJob_Connect
        • PR_QueueJob_Read
        • PR_QueueJob_Timer
        • PR_QueueJob_Write
        • PR_QueueJob_Accept
        • PR_Read
        • PR_ReadDir
        • PR_Realloc
        • PR_Recv
        • PR_RecvFrom
        • PR_REMOVE_AND_INIT_LINK
        • PR_REMOVE_LINK
        • PR_Rename
        • PR_RmDir
        • PR_SecondsToInterval
        • PR_Seek
        • PR_Seek64
        • PR_Send
        • PR_SendTo
        • PR_SetConcurrency
        • PR_SetError
        • PR_SetErrorText
        • PR_SetLibraryPath
        • PR_SetPollableEvent
        • PR_SetSocketOption
        • PR_SetThreadPriority
        • PR_SetThreadPrivate
        • PR_Shutdown
        • PR_ShutdownThreadPool
        • PR_Sleep
        • PR_STATIC_ASSERT
        • PR_StringToNetAddr
        • PR_strtod
        • PR_Sync
        • PR_TicksPerSecond
        • PR_TransmitFile
        • PR_UnblockClockInterrupts
        • PR_UnloadLibrary
        • PR_Unlock
        • PR_MemUnmap
        • PR_USEC_PER_MSEC
        • PR_USEC_PER_SEC
        • PR_VERSION
        • PR_VersionCheck
        • PR_Wait
        • PR_WaitCondVar
        • PR_WaitForPollableEvent
        • PR_WaitSemaphore
        • PR_Write
        • PR_Writev
        • PRAccessHow
        • PRBool
        • PRCallOnceFN
        • PRCallOnceType
        • PRCList
        • PRCondVar
        • PRDescIdentity
        • PRDir
        • PRErrorCode
        • PRExplodedTime
        • PRFileDesc
        • PRFileInfo
        • PRFileInfo64
        • PRFileMap
        • PRFilePrivate
        • PRFileType
        • PRFloat64
        • PRHostEnt
        • PRInt16
        • PRInt32
        • PRInt64
        • PRInt8
        • PRIntervalTime
        • PRIntn
        • PRIOMethods
        • PRIPv6Addr
        • PRJob
        • PRJobFn
        • PRJobIoDesc
        • PRLibrary
        • PRLinger
        • PRLock
        • PR_NewLogModule
        • PRLogModuleLevel
        • PRMcastRequest
        • PRMonitor
        • PRNetAddr
        • Process Initialization
        • Process Management And Interprocess Communication
        • PRPackedBool
        • PRPrimordialFn
        • PRProcess
        • PRProcessAttr
        • PRProtoEnt
        • PRPtrdiff
        • PRSeekWhence
        • PRSize
        • PRSocketOptionData
        • PRSockOption
        • PRStaticLinkTable
        • PRStatus
        • PRThread
        • PRThreadPool
        • PRThreadPriority
        • PRThreadPrivateDTOR
        • PRThreadScope
        • PRThreadStack
        • PRThreadState
        • PRThreadType
        • PRTime
        • PRTimeParameters
        • PRTimeParamFn
        • PRUint16
        • PRUint32
        • PRUint64
        • PRUint8
        • PRUintn
        • PRUnichar
        • PRUptrdiff
        • Random Number Generator
        • String Operations
        • Thread Pool Types
        • Thread Pool Functions
        • Threading Types and Constants
        • Threading Functions
  • Network Security Services (NSS)
  • Web Security Checks in Gecko

The Firefox Build System

  • Mach
  • Pushing to Try
  • Build System
  • Firefox CI and Taskgraph
  • Managing Documentation
  • Vendoring Third Party Components

Testing & Test Infrastructure

  • Automated Testing
  • Understanding Treeherder Results
  • Sheriffed intermittent failures
  • Turning on Firefox tests for a new configuration
  • Avoiding intermittent tests
  • Debugging Intermittent Test Failures
  • Testing Policy
  • Configuration Changes
  • Browser chrome mochitests
  • Chrome Tests
  • geckodriver
  • Test Verification
  • WebRender Tests
  • Mochitest
  • XPCShell tests
  • TPS
  • web-platform-tests
  • GTest
  • Fuzzing
  • Sanitizer
  • Performance Testing
  • Code coverage
  • Testing & Debugging Rust Code

AI Agent Tools

  • AI Agent Tools for Firefox Development

Releases & Updates

  • Mozilla Update Infrastructure
  • Watershed Updates
  • Desupport Updates
  • Update Verify

Localization & Internationalization

  • Internationalization
  • Localization

Firefox and Python

  • mozbase
  • Using third-party Python packages

Metrics Collected in Firefox

  • Firefox metrics
Firefox Source Docs
  • NSPR
  • NSPR listing
  • Dynamic Library Search
  • Report an issue / View page source

Dynamic Library Search

This section describes NSPR’s programming interface to load, unload and resolve symbols in dynamic libraries. It also provides a method by which to condition symbols of statically linked code so that to other clients it appears as though they are dynamically loaded.

Library Linking Types

These data types are defined for dynamic library linking:

  • PRLibrary

  • PRStaticLinkTable

Library Linking Functions

The library linking functions are:

  • PR_SetLibraryPath

  • PR_GetLibraryPath

  • PR_GetLibraryName

  • PR_FreeLibraryName

  • PR_LoadLibrary

  • PR_UnloadLibrary

  • PR_FindSymbol

  • PR_FindSymbolAndLibrary

Finding Symbols Defined in the Main Executable Program

PR_LoadLibrary cannot open a handle that references the main executable program. (This is admittedly an omission that should be fixed.) However, it is possible to look up symbols defined in the main executable program as follows.

PRLibrary *lib;
void *funcPtr;

funcPtr = PR_FindSymbolAndLibrary("FunctionName", &lib);

When PR_FindSymbolAndLibrary returns, funcPtr is the value of the function pointer you want to look up, and the variable lib references the main executable program. You can then call PR_FindSymbol on lib to look up other symbols defined in the main program. Remember to call PR_UnloadLibrary(lib) to close the library handle when you are done.

Platform Notes

To use the dynamic library loading functions on some platforms, certain environment variables must be set at run time, and you may need to link your executable programs using special linker options.

This section summarizes these platform idiosyncrasies. For more information, consult the man pages for ld and dlopen (or shl_load on HP-UX) for Unix, and the LoadLibrary documentation for Win32.

  • Dynamic Library Search Path

  • Exporting Symbols from the Main Executable Program

Dynamic Library Search Path

The dynamic library search path is the list of directories in which to look for a dynamic library. Each platform has its own standard directories in which to look for dynamic libraries, plus a customizable list of directories specified by an environment variable.

  • On most Unix systems, this environment variable is LD_LIBRARY_PATH. These systems typically use dlopen to load a dynamic library.

  • HP-UX uses shl_load to load dynamic libraries, and the environment variable specifying the dynamic library search path is SHLIB_PATH. Moreover, the executable program must be linked with the +s option so that it will search for shared libraries in the directories specified by SHLIB_PATH at run time. Alternatively, you can enable the +s option as a postprocessing step using the chatr tool. For example, link your executable program a.out without the +s option, then execute the following:

chatr +s enable a.out
  • On Rhapsody, the environment variable is DYLD_LIBRARY_PATH.

  • On Win32, the environment variable is PATH. The same search path is used to search for executable programs and DLLs.

Exporting Symbols from the Main Executable Program

On some systems, symbols defined in the main executable program are not exported by default. On HP-UX, you must link the executable program with the -E linker option in order to export all symbols in the main program to shared libraries. If you use the GNU compilers (on any platform), you must also link the executable program with the -E option.

Previous Next

Built with Sphinx using a theme provided by Read the Docs.