encyclopegia.org

wrapper library

Wrapper libraries (or library wrappers) consist of a thin layer of code (a "shim") which translates a library's existing interface into a compatible interface. This is done for several reasons: * To refine a poorly designed or complicated interface * Allow code to work together which otherwise cannot (e.g. incompatible data formats) * Enable cross language and/or runtime interoperability Wrapper libraries can be implemented using the adapter, façade, and to a lesser extent, proxy design patterns.

Wrapper libraries (or library wrappers) consist of a thin layer of code (a "shim") which translates a library's existing interface into a compatible interface. This is done for several reasons: To refine a poorly designed or complicated interface Allow code to work together which otherwise cannot (e.g. incompatible data formats) Enable cross language and/or runtime interoperability Wrapper libraries can be implemented using the adapter, façade, and to a lesser extent, proxy design patterns. include // previous declarations... int pthread_mutex_init(pthread_mutex_t* mutex , const pthread_mutexattr_t* attr); int pthread_mutex_destroy(pthread_mutex_t* mutex); int pthread_mutex_lock(pthread_mutex_t* mutex); int pthread_mutex_unlock(pthread_mutex_t* mutex); // more functions... export module org.posix.PosixThread; import ; export namespace org::posix { // previous wrappers... class ThreadMutex { private: ::pthread_mutex_t mutex; friend class ThreadLock; void lock() noexcept { ::pthread_mutex_lock(&mutex); } void unlock() noexcept { ::pthread_mutex_unlock(&mutex); } public: ThreadMutex() { ::pthread_mutex_init(&mutex, 0); } ~ThreadMutex() { ::pthread_mutex_destroy(&mutex); } }; class ThreadLock { private: ThreadMutex& mutex; public: explicit ThreadLock(ThreadMutex& mutex): mutex{mutex} { mutex.lock(); } ~ThreadLock() { mutex.unlock(); } }; // more wrappers... } The original C interface can be regarded as error prone, particularly in the case where users of the library forget to unlock an already locked mutex. The new interface effectively utilizes resource acquisition is initialization (RAII) in the new and classes to ensure s are eventually unlocked and objects are automatically released. The above code closely mimics the implementation of and classes from Boost which are part of the Boost.Thread library. ==See also== Wrapper function Wrapper pattern Glue code

References

No reference rows published for this article.

Cite this article

MLA

"wrapper library." encyclopegia.org, 2025, https://encyclopegia.org/wiki/wrapper-library. Accessed 24 November 2026.

Chicago

"wrapper library." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/wrapper-library.

APA

encyclopegia.org. (2025). wrapper library. Retrieved November 24, 2026, from https://encyclopegia.org/wiki/wrapper-library

Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

NASCAR 98

stub · references available

NBA 2K3

stub · references available

NBA Action

stub · references available

Randy Stumpfhauser

stub · references available

NBBJ

stub · references available

NBA in the Zone

stub · references available

NBA Street Showdown

stub · references available
CC BY-SA 4.0 · tier1-factual · https://en.wikipedia.org/w/index.php?oldid=1317928613 · 0.55 · snapshot wrapper-library-388994-fcfc481b1705be34 · QID Q3363001

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.