encyclopegia.org

Wrapper function

A wrapper function is a function (another word for a subroutine) in a software library or a computer program whose main purpose is to call a second subroutine or a system call with little or no additional computation. Wrapper functions simplify writing computer programs by abstracting the details of a subroutine's implementation.

A wrapper function is a function (another word for a subroutine) in a software library or a computer program whose main purpose is to call a second subroutine or a system call with little or no additional computation. Wrapper functions simplify writing computer programs by abstracting the details of a subroutine's implementation. ===Adapting class/object interfaces=== Wrapper functions can be used to adapt an existing class or object to have a different interface. This is especially useful when using existing library code. ===Code testing=== Wrapper functions can be used to write error checking routines for pre-existing system functions without increasing the length of a code by a large amount by repeating the same error check for each call to the function. All calls to the original function can be replaced with calls to the wrapper, allowing the programmer to forget about error checking once the wrapper is written. A test driver is a kind of wrapper function that exercises a code module, typically calling it repeatedly, with different settings or parameters, in order to rigorously pursue each possible path. It is not deliverable code, but it is not throwaway code either, being typically retained for use in regression testing. An interface adaptor is a kind of wrapper function that simplifies, tailors, or amplifies the interface to a code module, with the intent of making it more intelligible or relevant to the user. It may rename parameters, combine parameters, set defaults for parameters, and the like. ===Multiple inheritance=== In a programming language that does not support multiple inheritance of base classes, wrapper functions can be used to simulate it. Below is an example of part of a Java class that "inherits" from java.util.LinkedList and java.util.HashSet . See method for further implementation details. import java.util.HashSet; import java.util.LinkedList; public class Test implements LinkedList, HashSet { @Override // contains data members and data methods // covariant return } ==Library functions and system calls== Many library functions, such as those in the C Standard Library, act as interfaces for abstraction of system calls. The fork and execve functions in glibc are examples of this. They call the lower-level fork and execve system calls, respectively. This may lead to incorrectly using the terms "system call" and "syscall" to refer to higher-level library calls rather than the similarly named system calls, which they wrap. ==Helper function== A helper function is a function which groups parts of computation by assigning descriptive names and allowing for the reuse of the computations. Although not all wrappers are helper functions, all helper functions are wrappers, and a notable use of helper functions—grouping frequently utilized operations—is in dynamic binary translation, in which helper functions of a particular architecture are used in translation of instructions from one instruction set into another. ==See also== Wrapper library Driver wrapper Adapter pattern Decorator pattern Delegation (programming) Forwarding (object-oriented programming) Language binding wrapper to another language SWIG automatic wrapper generator Nested function Partial application ==References==

References

No reference rows published for this article.

Cite this article

MLA

"Wrapper function." encyclopegia.org, 2026, https://encyclopegia.org/wiki/wrapper-function. Accessed 23 November 2026.

Chicago

"Wrapper function." encyclopegia.org. Accessed November 23, 2026. https://encyclopegia.org/wiki/wrapper-function.

APA

encyclopegia.org. (2026). Wrapper function. Retrieved November 23, 2026, from https://encyclopegia.org/wiki/wrapper-function

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

Related articles

Helium atom

enwiki · references available

Louis-Henri Foreau

enwiki · references available

Credit Karma

enwiki · references available

Fox Factory

enwiki · references available

Ian Burn

enwiki · references available

Breaking Up with Shannen Doherty

enwiki · references available

Sailfin tang

enwiki · references available

Zebrasoma xanthurum

enwiki · references available

Papermoon (song)

enwiki · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1350540621 · 0.5 · snapshot enwiki-001350540621

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.