翻訳と辞書
Words near each other
・ Foreign Exchange Regulation Act
・ Foreign exchange reserves of China
・ Foreign exchange reserves of India
・ Foreign exchange risk
・ Foreign exchange service
・ Foreign exchange service (telecommunications)
・ Foreign exchange spot
・ Foreign Exchange Student
・ Foreign exchange swap
・ Foreign Extemporaneous Speaking
・ Foreign Extraterritorial Measures Act
・ Foreign fighters in the Bosnian War
・ Foreign football players in Germany
・ Foreign footballers in Ukrainian Premier League listed by club
・ Foreign forced labor in the Soviet Union
Foreign function interface
・ Foreign Girls
・ Foreign government advisors in Meiji Japan
・ Foreign grain beetle
・ Foreign Harbour
・ Foreign hostages in Afghanistan
・ Foreign hostages in Iraq
・ Foreign hostages in Nigeria
・ Foreign hostages in Pakistan
・ Foreign hostages in Somalia
・ Foreign housing exclusion
・ Foreign instrumentation signals intelligence
・ Foreign Intelligence Service (Kazakhstan)
・ Foreign Intelligence Service (Romania)
・ Foreign Intelligence Service (Russia)


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

Foreign function interface : ウィキペディア英語版
Foreign function interface
A foreign function interface (FFI) is a mechanism by which a program written in one programming language can call routines or make use of services written in another. The term comes from the specification for Common Lisp, which explicitly refers to the language features for inter-language calls as such; the term is also used officially by the Haskell and Python programming languages.〔(【引用サイトリンク】url=https://cffi.readthedocs.org/ )〕 Other languages use other terminology: the Ada programming language talks about "language bindings", while Java refers to its FFI as the JNI (Java Native Interface) or JNA (Java Native Access). Foreign function interface has become generic terminology for mechanisms which provide such services.
Some foreign function interfaces (FFIs) are restricted to free standing functions while others also allow calls of functions embedded in an object or class (often called method calls); some even permit migration of complex datatypes and/or objects across the language boundary.
The term foreign function interface is generally not used to describe multi-lingual runtimes such as the Microsoft Common Language Runtime, where a common "substrate" is provided which enables any CLR-compliant language to use services defined in any other. (However, in this case the CLR does include an FFI, P/Invoke, to call outside the runtime.) In addition, many distributed computing architectures such as the Java remote method invocation (RMI), RPC, CORBA, SOAP and D-Bus permit different services to be written in different languages; such architectures are generally not considered FFIs.
In most cases, a FFI is defined by a "higher-level" language, so that it may employ services defined and implemented in a lower level language, typically a systems language like C or C++. This is typically done to either access OS services in the language in which the OS' API is defined, or for performance considerations.
Many FFIs also provide the means for the called language to invoke services in the host language as well.
==Operation of an FFI==
The primary function of a FFI is to mate the semantics and calling conventions of one programming language (the ''host'' language, or the language which defines the FFI), with the semantics and conventions of another (the ''guest'' language). This process must also take into consideration the runtime environments and/or application binary interfaces of both. This can be done in several ways:
* Requiring that guest-language functions which are to be host-language callable be specified or implemented in a particular way; often using a compatibility library of some sort.
* Use of a tool to automatically "wrap" guest-language functions with appropriate glue code, which performs any necessary translation.
* Use of wrapper libraries
* Restricting the set of host language capabilities which can be used cross-language. For example, C++ functions called from C may not (in general) include reference parameters or throw exceptions.
FFIs may be complicated by the following considerations:
* If one language supports garbage collection (GC) and the other does not; care must be taken that the non-GC language code doesn't do something to cause GC in the other to fail. In JNI, for example, C code, which "holds on to" object references that it receives from Java, must "register" this fact with the Java runtime environment (JRE); otherwise, Java may delete objects before C has finished with them. (The C code must also explicitly release its link to any such object, as soon as there is no further need, by C, of that object.)
* Complicated or non-trivial objects or datatypes may be difficult to map from one environment to another.
* It may not be possible for both languages to maintain references to the same instance of a mutable object, due to the mapping issue above.
* One or both languages may be running on a virtual machine (VM); moreover, if both are, these will probably be different VMs.
* Cross-language inheritance and other differences, such as between type systems or between object-composition models, may be especially difficult.

抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「Foreign function interface」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.