HOME

TheInfoList



OR:

In
computer programming Computer programming is the process of performing a particular computation (or more generally, accomplishing a specific computing result), usually by designing and building an executable computer program. Programming involves tasks such as anal ...
, a shim is a
library A library is a collection of materials, books or media that are accessible for use and not just for display purposes. A library provides physical (hard copies) or digital access (soft copies) materials, and may be a physical location or a vi ...
that transparently intercepts API calls and changes the arguments passed, handles the operation itself or redirects the operation elsewhere. Shims can be used to support an old API in a newer environment, or a new API in an older environment. Shims can also be used for running programs on different software platforms than they were developed for. Shims for older APIs typically come about when the behavior of an API changes, thereby causing compatibility issues for older applications which still rely on the older functionality; in such cases, the older API can still be supported by a thin
compatibility layer In software engineering, a compatibility layer is an interface that allows binaries for a legacy or foreign system to run on a host system. This translates system calls for the foreign system into native system calls for the host system. With s ...
on top of the newer code. Shims for newer APIs are defined as: "a
library A library is a collection of materials, books or media that are accessible for use and not just for display purposes. A library provides physical (hard copies) or digital access (soft copies) materials, and may be a physical location or a vi ...
that brings a new API to an older environment, using only the means of that environment."


Examples

* Web polyfills implement newer web standards using older standards and
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of websites use JavaScript on the client side for webpage behavior, of ...
, if the newer standard is not available in a given
web browser A web browser is application software for accessing websites. When a user requests a web page from a particular website, the browser retrieves its files from a web server and then displays the page on the user's screen. Browsers are used o ...
. * Support of
AppleTalk AppleTalk is a discontinued proprietary suite of networking protocols developed by Apple Computer for their Macintosh computers. AppleTalk includes a number of features that allow local area networks to be connected with no prior setup or the ...
on
Macintosh The Mac (known as Macintosh until 1999) is a family of personal computers designed and marketed by Apple Inc., Apple Inc. Macs are known for their ease of use and minimalist designs, and are popular among students, creative professionals, and ...
computers, during the brief period in which
Apple Computer Apple Inc. is an American multinational technology company headquartered in Cupertino, California, United States. Apple is the largest technology company by revenue (totaling in 2021) and, as of June 2022, is the world's biggest company ...
supported the
Open Transport Open Transport was the name given by Apple Inc. to its implementation of the Unix-originated System V STREAMS networking stack. Based on code licensed from Mentat's Portable Streams product, Open Transport was built to provide the classic Mac OS ...
networking system. Thousands of Mac programs were based on the AppleTalk protocol; to support these programs, AppleTalk was re-implemented as an OpenTransport "stack", and then re-implemented as an API shim on top of this new library. * The
Microsoft Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for ...
Application Compatibility Toolkit (ACT) uses the term to mean
backward compatible Backward compatibility (sometimes known as backwards compatibility) is a property of an operating system, product, or technology that allows for interoperability with an older legacy system, or with input designed for such a system, especially in ...
libraries. Shims simulate the behavior of older versions of Windows for legacy applications that rely on incorrect or deprecated functionality, or correct the way in which poorly written applications call unchanged APIs, for example to fix least-privileged user account (LUA) bugs. * bind.so is a shim library for
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, whi ...
that allows any application, regardless of permissions, to bind to a listening socket or specify outgoing IP address. It uses the LD_PRELOAD mechanism, which allows shims and other libraries to be loaded into any program. * In the ''type tunnel'' pattern, a generic interface layer uses a family of shims to translate a heterogeneous set of types to a single primitive type used by an underlying API.


See also

*
Adapter pattern In software engineering, the adapter pattern is a software design pattern (also known as wrapper, an alternative naming shared with the decorator pattern) that allows the interface of an existing class to be used as another interface. It is often ...
* Application virtualization *
Driver wrapper A driver wrapper is a Wrapper function, subroutine in a software library that functions as an adapter pattern, adapter between an operating system and a driver, such as a device driver, that was not designed for that operating system. It can enable ...
* Glide wrapper *
Glue code Adhesive, also known as glue, cement, mucilage, or paste, is any non-metallic substance applied to one or both surfaces of two separate items that binds them together and resists their separation. The use of adhesives offers certain advant ...
* Stub (computer science) *
Thunk (compatibility mapping) In computer programming, a thunk is a subroutine used to inject a calculation into another subroutine. Thunks are primarily used to delay a calculation until its result is needed, or to insert operations at the beginning or end of the other sub ...
*
Windows on Windows In computing, Windows on Windows (commonly referred to as WOW), was a compatibility layer of 32-bit versions of the Windows NT family of operating systems since 1993 with the release of Windows NT 3.1, which extends NTVDM to provide limited ...
(WoW) *
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 interfac ...


References

{{reflist, 30em


External links


Microsoft Dev-Center - Windows 8 Client and Server 2012 application Compatibility

Microsoft TechNet - Understanding Shims
Application programming interfaces Compatibility layers