A Wrapper, in programming, is a piece of code (often a function, a set of functions, or a class) that encapsulates or "wraps around" another piece of code, such as a library or a system API. The purpose of a wrapper is to simplify or adapt the interface of the code it is wrapping. There are several reasons to use a wrapper.
One is to simplify a complex interface. A library might require a dozen complicated steps to perform a task; a wrapper function could be created that performs all those steps with a single, simple function call.
Another reason is to increase portability. If a program needs to run on different operating systems, a programmer can write a wrapper around the OS-dependent functions. The main program calls the simple wrapper function, and the wrapper's internal code handles the specific implementation details for each OS. In the context of instrument control, a programmer might write their own wrapper functions around the standard VISA library calls.
For example, instead of making separate viWrite() and viRead() calls to perform a query, they could create a single wrapper function called Ask(command_string) that handles both operations and includes error checking. This makes the main body of the test program cleaner, more readable, and easier to maintain.