Shim
shimとは、コンピュータプログラミングにおいて、透過的にAPI呼び出しを傍受し、渡される引数を変更したり、操作自体…

shimとは、コンピュータプログラミングにおいて、透過的にAPI呼び出しを傍受し、渡される引数を変更したり、操作自体を処理したり、他の場所へ操作をリダイレクトするライブラリである[1][2]。shimは、新しい環境で古いAPIをサポートするため、あるいは古い環境で新しいAPIをサポートするために使用されることがある。また、開発されたソフトウェアプラットフォームとは異なるプラットフォーム上でプログラムを実行するためにも使用される。
古いAPI用のshimは、通常APIの動作が変更されたことで、従来の機能に依存していた古いアプリケーションが互換性の問題を起こすときに登場する。このような場合、古いAPIは新しいコードの上に薄い互換レイヤーを設けることでサポートされ得る。新しいAPI用のshimは「その環境の手段のみを用いて、新しいAPIを古い環境にもたらすライブラリ」と定義される[3]。
例
Webのポリフィルは、特定のウェブブラウザで新しいウェブ標準が利用できない場合に、古い標準やJavaScriptを用いて新しい標準を実装する[3]。
AppleTalkのサポートは、Macコンピュータにおいて、AppleがOpen Transportネットワークシステムを短期間サポートしていた時期に実現された。何千ものMac用プログラムがAppleTalkプロトコルに基づいており、これらをサポートするためにAppleTalkはOpen Transportの「スタック」として再実装され、さらにこの新しいライブラリ上にAPI shimとして再実装された。
Microsoft WindowsのApplication Compatibility Toolkit (ACT) では、この用語は後方互換ライブラリを意味する。shimは、古いバージョンのWindowsに依存するレガシーアプリケーションのために、古いバージョンの動作をシミュレートしたり、変更されていないAPIの呼び出し方法が不適切なアプリケーションに対処したりする。たとえば、最小特権ユーザーアカウント (LUA)に関連するバグを修正する目的で用いられる[4]。
bind.soは、Linux用のshimライブラリであり、任意のアプリケーションが、権限にかかわらず、リッスンソケットへのバインドや送信元IPアドレスの指定を可能にする[5]。これは、任意のプログラムにshimや他のライブラリを読み込むことができるLD_PRELOADメカニズムを利用している。
「type tunnel」パターンにおいては、汎用のインターフェース層が一連のshimを利用して、異種の型集合を基盤となるAPIが使用する単一のプリミティブ型に変換する[6]。
関連項目
脚注
- ^ “Your company's apps incompatible with Windows 7? Shim them, says Microsoft”. Computerworld (2009年3月21日). 2014年4月7日時点のオリジナルよりアーカイブ。2014年4月5日閲覧。
- ^ “Demystifying Shims - or - Using the App Compat Toolkit to make your old stuff work with your new stuff”. Microsoft TechNet (2011年6月17日). 2014年4月5日閲覧。
- ^ a b アクセル・ラウシュマイヤー (2014). Speaking JavaScript. Shims Versus Polyfills
- ^ “Microsoft Application Compatibility Toolkit 5.0”. Microsoft (2007年12月11日). 2008年6月24日閲覧。
- ^ “Source code of bind.so”. Daniel Ryde (2010年1月9日). 2014年3月30日時点のオリジナルよりアーカイブ。2014年4月5日閲覧。
- ^ ウィルソン, マシュー (August 2003), “Generalized String Manipulation: Access Shims and Type Tunneling”, C/C++ Users Journal 21 (8)
外部リンク
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.