鸡蛋价格为什么这么低| 晶莹剔透是什么意思| 突然的反义词是什么| 十九畏是什么意思| 什么是上升星座| 居居是什么意思| sweet什么意思| 肝火大吃什么药| 梦见蛇是什么预兆| 丑时属什么生肖| 什么是可支配收入| 意味深长是什么意思| 怀孕十天有什么反应| 脚转筋是什么原因| 闷骚什么意思| 什么属相不能挂山水画| 什么的手| 1953年属什么| 斑鸠和鸽子有什么区别| 佳字属于五行属什么| 红小豆和赤小豆有什么区别| rem睡眠是什么意思| 女人是什么动物| 指甲油什么牌子好| 阴蒂痒是什么原因| 1946年属什么生肖属相| 努力的意义是什么| 前列腺炎需要做什么检查| 梦见过年是什么意思| 番石榴是什么| 10.21是什么星座| 青少年长白头发是什么原因| 脑供血不足食补吃什么| 胸痛一阵一阵的痛什么原因| c反应蛋白偏高是什么原因| 孩子咽炎老是清嗓子吃什么药| 2025年是什么命| 吃燕麦片有什么好处| 阴道吹气是什么原因| 脂肪酶是什么| 送父亲什么礼物好| 刺梨果有什么功效| 造影检查是什么意思| b12有什么作用| 狮子女喜欢什么样的男生| 7月7号是什么星座| 吃生红枣有什么好处| 小腹胀痛吃什么药| ct胸部平扫检查出什么| 阴到炎用什么药好得快| o型血阳性是什么意思| 气郁症是什么症状| 4月21日什么星座| 梦见皮带断了什么预兆| 什么菜补铁| 幸福是什么的经典语录| 肾在五行中属什么| 什么是坐骨神经疼有什么症状| 梦见豹子是什么预兆| 猪大肠炒什么好吃| 石家庄有什么好玩的景点| 张国立老婆叫什么名字| 女性适合喝什么茶| 蚊虫叮咬红肿用什么药快速消肿| 1958属什么生肖| 荨麻疹用什么药最好| 洗纹身去医院挂什么科| 甲沟炎是什么样子的| 白带发黄是什么原因引起的| 嫦娥奔月是什么节日| 茯苓和茯神有什么区别| 怀孕了吃什么药能打掉| 冷淡是什么意思| 巨石强森是什么人种| 4月6号是什么星座| 尾盘跳水意味着什么| 什么的流着| solo 什么意思| 五行缺金是什么意思| 酸西地那非片是什么药| 头七是什么意思| 乐意是什么意思| 完蛋是什么意思| 翻身是什么意思| 六月一号什么星座| 碟中谍是什么意思| 理疗和按摩有什么区别| 一意孤行是什么意思| 肝火大吃什么药| 血糖高要注意什么| 阿修罗道是什么意思| 潜能什么意思| 咳嗽吃什么菜| 烩是什么意思| 食糜是什么意思| 愿君多采撷是什么意思| 眩晕挂号挂什么科| 瑶五行属什么| 为什么嗓子总有痰| 肺炎是什么原因引起的| 麦粒肿滴什么眼药水| 肠易激综合症吃什么药| 领结婚证需要带什么材料| 鸡枞菌长在什么地方| 宝付支付是什么| 胀气吃什么| 胃病是什么原因引起的| 跳爵士舞穿什么衣服| 社保缴纳基数是什么意思| 骨蒸潮热是什么症状| 会厌炎吃什么药最有效| 吕布的武器是什么| kid是什么意思| 干嘛是什么意思| 医生代表什么生肖| 感冒有痰吃什么药| 颜值担当是什么意思| 女人得痔疮原因是什么| 嗓子疼可以吃什么水果| 被蜜蜂蛰了涂什么药膏| 耸肩是什么意思| 双子男和什么星座最配| 7月1号什么星座| 穷字代表什么生肖| 游乐场都有什么项目| 清凉补是什么| 备孕做什么检查| 桫椤是什么植物| 现在当兵需要什么条件| 耳鸣去医院挂什么科| 什么是数位板| 甲状腺1类是什么意思| 做梦坐飞机是什么意思| 骨癌的前兆是什么症状| 落枕贴什么膏药| 为什么一躺下就头晕目眩| 毛囊炎的症状是什么原因引起的| 羊经后半边读什么| 呼吸重是什么原因| 熬粥用什么锅好| 毛尖属于什么茶| 新生儿黄疸高有什么危害| 有什么好| 国防部部长是什么级别| 为什么会尿路感染| 学生早餐吃什么方便又营养| 左眼皮跳代表什么| 恩惠是什么意思| 齐天大圣是什么级别| 心寒是什么意思| 火同念什么| 陈皮和什么泡水喝最好| 胸口疼是什么原因| 心穷是什么意思| 疤痕增生是什么原因| 四月初四是什么节日| 茶壶里煮饺子的歇后语是什么| 抢救失血伤员时要先采取什么措施| 阴道口发白是什么原因| b3是什么维生素| 得了梅毒会有什么症状| 媒婆是什么意思| 轻度抑郁有什么症状| 山魈是什么| 小狗拉稀 吃什么药| 怀姜是什么姜| 看腋臭挂什么科| 幽门螺杆菌感染吃什么药| 白萝卜煮水喝有什么功效| 野鸡吃什么| 阅历是什么意思| 长期便秘是什么原因引起的| 下午右眼跳是什么预兆| 建议是什么意思| 肠系膜淋巴结炎吃什么药| 腰肌劳损有什么症状| 蝴蝶什么意思| 银行行长是什么级别| 转氨酶高对身体有什么影响| 亢是什么意思| 阴到炎用什么药好得快| 粉刺长什么样图片| 喝什么茶不影响睡眠| 乡政府属于什么单位| 艾滋病早期有什么症状| 四肢肌力5级什么意思| 抗酸杆菌是什么意思| 百香果配什么好喝| joola是什么牌子| 梦见好多肉是什么意思| 血压高吃什么药比较好| 热感冒吃什么药| 黄色衣服配什么颜色裤子好看| 安抚奶嘴什么时候开始用| 精修照片用什么软件| 家里有壁虎是什么征兆| 潜血弱阳性是什么意思| 结婚唱什么歌送给新人| 头皮一阵一阵发麻是什么原因| 11是什么意思| 腿弯后面疼是什么原因| 无大碍是什么意思| 拉肚子肚子疼吃什么药| 湿疣是什么病| 三亚在海南的什么位置| 月经量多是什么原因| 从良是什么意思| 什么验孕棒准确率高| 冬枣什么时候上市| 谷草转氨酶偏低是什么原因| 什么太阳| 打2个喷嚏代表什么| 职业测试你适合什么工作| 宫颈糜烂用什么药好得快| 仰卧起坐有什么好处| 直升是什么意思| 双子座和什么星座最不配| 葡萄糖氯化钠注射作用是什么| 澳门用什么币种| 毛发变白是什么原因| 吃什么祛痰化痰最有效| 硅橡胶是什么材料| 鼠辈是什么意思| 5月28号是什么日子| 普拉提是什么运动| 梦见着火是什么意思| 清华大学是什么级别| 方脸适合什么耳环| 吃维生素c有什么好处| 吃莲子有什么好处| 眼眶发青是什么原因| 枳是什么意思| b是什么牌子的衣服| 原味是什么意思| 间接胆红素高说明什么| 做狐臭手术挂什么科| 减肥饿了可以吃什么| 霸王龙的后代是什么| 什么的雄鸡| 糖抗原125高什么意思| 支教回来后有什么待遇| 阿玛尼手表属于什么档次| 萧敬腾为什么叫雨神| 抖机灵是什么意思| 下巴下面长痣代表什么| 炒什么菜适合拌面| 子宫肌瘤吃什么能消除| 圣灵是什么意思| 高血压挂什么科室| 冬至有什么忌讳| 别开生面是什么意思| 芙蕖是什么花| 任督二脉是什么意思| 陈皮治什么病| 白玫瑰花语是什么意思| 湿疹是因为什么原因引起的| 浅表性胃炎吃什么中成药最好| 外阴长水泡是什么原因| 皮肤癣用什么药| 糖类抗原153偏高是什么原因| 外包什么意思| pagani是什么车| 破费是什么意思| 脑供血不足什么原因引起的| 百度Jump to content

甘肃省林业厅党组书记、厅长马光明接受组织审查

From Wikipedia, the free encyclopedia
百度   陕西、云南、中国铁路总公司党组均被指贯彻落实习近平总书记系列重要讲话精神不够到位,中央网信办和国务院扶贫办的共同问题是贯彻落实习近平总书记重要指示和工作要求不够坚决、不够及时。

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 or compiled in another one. An FFI is often used in contexts where calls are made into a binary dynamic-link library.

Naming

[edit]

The term comes from the specification for Common Lisp, which explicitly refers to the programming language feature enabling for inter-language calls as such;[citation needed] the term is also often used officially by the interpreter and compiler documentation for Haskell,[1] Rust,[2] PHP,[3] Python, and LuaJIT (Lua)[4][5]:?35?.[6] Other languages use other terminology: Ada has language bindings, while Java has Java Native Interface (JNI), Java Native Access (JNA), or since Java 22, Foreign Function and Memory API. Foreign function interface has become generic terminology for mechanisms which provide such services.

Operation

[edit]

The primary function of a foreign function interface 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 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 a wrapper library
  • Restricting the set of host language abilities 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 does nothing 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 communicate this information successfully to the Java virtual machine or Java Runtime Environment (JRE), otherwise, Java may delete objects before C finishes with them. (The C code must also explicitly release its link to any such object once C has no further need 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 are often different VMs.
  • Cross-language inheritance and other differences, such as between type systems or between object composition models, may be especially difficult.

UML ffi.svg

Examples of FFIs include:

  • Ada language bindings, allowing not only to call foreign functions but also to export its functions and methods to be called from non-Ada code.[7]
  • C++ has a trivial FFI with C, as the languages share a significant common subset. The primary effect of the extern "C" declaration in C++ is to disable C++ name mangling. With other languages, separate utils or middleware are used, examples include:
  • Clean provides a bidirectional FFI with all languages following C or the stdcall calling convention.[8][9]
  • Common Lisp
  • Compiled Native Interface (CNI), alternative to JNI used in the GNU compiler environment.
  • One of the bases of the Component Object Model is a common interface format, which natively uses the same types as Visual Basic for strings and arrays.
  • D does it the same way as C++ does, with extern "C" through extern (C++)
  • Dart includes dart:ffi[10] library to call native C code for mobile, command-line, and server applications
  • Dynamic programming languages, such as Python, Perl, Tcl, and Ruby, all provide easy access to native code written in C, C++, or any other language obeying C/C++ calling conventions.
  • Factor has FFIs for C, Fortran, Objective-C, and Windows COM; all of these enable importing and calling arbitrary shared libraries dynamically.
  • Fortran 2003 has a module ISO_C_BINDING which provides interoperable data types (both intrinsic types and POD structs), interoperable pointers, interoperable global data stores, and mechanisms for calling C from Fortran and for calling Fortran from C.[11] It has been improved in the Fortran 2018 standard.
  • Go can call C code directly via the "C" pseudo-package.[12]
  • Google Web Toolkit (GWT), in which Java is compiled to JavaScript, has an FFI named JSNI which allows Java source code to call arbitrary JavaScript functions, and for JavaScript to call back into Java.
  • Haskell
  • Java Native Interface (JNI), which provides an interface between Java and C/C++, the preferred systems languages on most systems where Java is deployed. Java Native Access (JNA) provides an interface with native libraries without having to write glue code. In Java 22, the Foreign Function and Memory API was added which is a modern replacement for JNI.
  • LuaJIT, a just-in-time implementation of Lua, has an FFI that allows "calling external C functions and using C data structures from pure Lua code".[4][5]:?35?
  • .NET have FFI through its LibraryImport attribute.
  • Nim has an FFI which enables it to use source from C, C++, and Objective-C. It can also interface with JavaScript.
  • JavaScript usually runs inside web browser runtimes that don't provide direct access to system libraries or commands to run, but there are few exceptions:
    • Node.js provides functions to open precompiled .node modules that in turn may provide access to non-builtin resources.
    • Deno, provides kind of FFI interface via dlopen(...) functions.[13]
    • Bun provides a built-in module, bun:ffi, to efficiently call native libraries directly from JavaScript.[14]
  • Julia has ccall keyword to call C (and other languages, e.g., Fortran);[15] while packages, providing similar no-boilerplate support, are available for some languages e.g., for Python[16] (to e.g. provide OO support and GC support), Java (and supports other JDK-languages, such as Scala) and R. Interactive use with C++ is also possible with Cxx.jl package.
  • PhoneGap (was named Apache Callback, but is now Apache Cordova) is a platform for building native mobile applications using HTML, CSS and JavaScript. Also, it has FFIs via JavaScript callback functions for access to methods and properties of mobile phone's native features including accelerometer, camera (also PhotoLibrary and SavedPhotoAlbum), compass, storage (SQL database and localStorage), notification, media and capture (playing and recording or audio and video), file, contacts (address book), events, device, and connection information.[1],[2].
  • PHP provides FFI to C.[17]
  • Pony supports integration with C via its FFI.[18]
  • Python provides the ctypes and cffi modules. For example, the ctypes module can load C functions from a shared library, or dynamic-link library (DLL) on-the-fly and translate simple data types automatically between Python and C semantics as follows:
    import ctypes
    libc = ctypes.CDLL("/lib/libc.so.6")  # Under Linux/Unix
    t = libc.time(None)                   # Equivalent C code: t = time(NULL)
    print(t)
    
  • P/Invoke, which provides an interface between the Microsoft Common Language Runtime and native code.
  • Racket has a native FFI based heavily on macros that enables importing arbitrary shared libraries dynamically.[19][20]
  • Raku can call Ruby, Python, Perl, Brainfuck, Lua, C, C++, Go, Scheme (Guile, Gambit), and Rust[21][22]
  • Ruby provides FFI either through the ffi gem, or through the standard library fiddle.
    require 'fiddle'
    
    libm = Fiddle.dlopen('/lib/libm.so.6')
    
    # Equivalent to: double floor(double x);
    floor = Fiddle::Function.new(
      libm.sym('floor'),     # ptr is a referenced function(, or symbol), of a Fiddle::Handle.
      [Fiddle::TYPE_DOUBLE], # args is an Array of arguments, passed to the ptr function.
      Fiddle::TYPE_DOUBLE    # ret_type is the return type of the function
    )
    
    # Equivalent to: floor(3.14159);
    floor.call(3.14159) #=> 3.0
    
  • Rust defines a foreign function interface to functions with various standard application binary interface (ABIs) in namespace std::ffi for calling C code.[23] There is also a library called CXX for interfacing with C++, as well as for Elixir, Rustler.
  • V (Vlang) can include and supports the use of C source code and libraries.[24]
  • Visual Basic has a declarative syntax that allows it to call non-Unicode C functions.
  • Wolfram Language provides a technology named Wolfram Symbolic Transfer Protocol (WSTP) which enables bidirectional calling of code between other languages with bindings for C++, Java, .NET. and other languages.
  • Zig provides FFI to C using the builtin cImport function.[25]

In addition, many FFIs can be generated automatically: for example, SWIG. However, in the case of an extension language a semantic inversion of the relationship of guest and host can occur, when a smaller body of extension language is the guest invoking services in the larger body of host language, such as writing a small plugin[26] for GIMP.[27]

Some 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 or objects across the language boundary.

In most cases, an FFI is defined by a higher-level language, so that it may employ services defined and implemented in a lower-level language, typically a system programming language like C or C++. This is typically done to either access operating system (OS) services in the language in which the OS API is defined, or for performance goals.

Many FFIs also provide the means for the called language to invoke services in the host language also.

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.

Special cases

[edit]

There are some special cases, in which the languages compile into the same bytecode VM, like Clojure and Java, as well as Elixir and Erlang. Since there is no interface, it is not an FFI, strictly speaking, while it offers the same functions to the user.

See also

[edit]

References

[edit]
  1. ^ "FFI Introduction". HaskellWiki. Retrieved 19 June 2015. Haskell's FFI is used to call functions from other languages (basically C at this point), and for C to call Haskell functions.
  2. ^ "std::ffi". Rust-lang.org. Retrieved 1 April 2021. This module provides utilities to handle data across non-Rust interfaces, like other programming languages and the underlying operating system. It is mainly of use for FFI (Foreign Function Interface) bindings and code that needs to exchange C-like strings with other languages.
  3. ^ "PHP FFI Manual". PHP Manual. Retrieved 31 August 2023. Defined C variables are made available as properties of the FFI instance.
  4. ^ a b Mike Pall. "FFI Library". Luajit.org. Retrieved 2025-08-05.
  5. ^ a b Heintz, Joachim; Hofmann, Alex; McCurdy, Iain (2013). Ways Ahead: Proceedings of the First International Csound Conference. Newcastle upon Tyne: Cambridge Scholars Publishing. ISBN 978-1-4438-5122-0. OCLC 855505215.
  6. ^ "CFFI documentation". Retrieved 19 June 2015. C Foreign Function Interface for Python. The goal is to provide a convenient and reliable way to call compiled C code from Python using interface declarations written in C.
  7. ^ "Interface to Other Languages". Adaic.org. Retrieved 2025-08-05.
  8. ^ "Foreign Export". Retrieved 2025-08-05.
  9. ^ "Calling C From Clean". Retrieved 2025-08-05.
  10. ^ "dart:ffi library". Retrieved 2025-08-05.
  11. ^ "'fortran-iso-c-binding' tag wiki". Stack Overflow.
  12. ^ "cgo". Go Programming Language. Retrieved 2025-08-05.
  13. ^ "Foreign Function Interface | Manual". Deno. Retrieved 2025-08-05.
  14. ^ "FFI API". Bun Docs.
  15. ^ "Calling C and Fortran Code". JuliaLang.org. Retrieved 2025-08-05.
  16. ^ PyCall.jl: Package to call Python functions from the Julia language, JuliaPy, 2025-08-05, retrieved 2025-08-05
  17. ^ "PHP: FFI - Manual". The PHP Group. Retrieved 13 June 2019.
  18. ^ "Pony C-FFI Overview". Retrieved 9 April 2025.
  19. ^ Eli Barzilay. "The Racket Foreign Interface". Docs.racket-lang.org. Retrieved 2025-08-05.
  20. ^ "TR600.pdf" (PDF). Archived from the original (PDF) on 2025-08-05. Retrieved 2025-08-05.
  21. ^ "Inline implementations". Retrieved 2025-08-05.
  22. ^ "Native Call". Retrieved 2025-08-05.
  23. ^ "Using extern Functions to Call External Code". Retrieved 2025-08-05.
  24. ^ "Including C code". Vlang. Retrieved 2025-08-05.
  25. ^ "Import from C Header File". Zig Software Foundation. Retrieved 2025-08-05.
  26. ^ "4. A sample script". Gimp.org. 2025-08-05. Retrieved 2025-08-05.
  27. ^ "Script-Fu and plug-ins for The GIMP". Gimp.org. Retrieved 2025-08-05.
[edit]


疱疹长什么样 那好吧是什么意思 身上长小肉揪是什么原因 什么是69 不造血是什么病
阑尾炎吃什么 立春是什么生肖 为什么我 一个夸一个瓜念什么 鼻窦炎有什么特效药
alan英文名什么意思 尾巴长长的是什么鸟 喝酒后肚子疼什么原因 互粉是什么意思 翩跹是什么意思
拉肚子拉稀水吃什么药管用 精华液是干什么用的 头皮屑特别多是什么原因 大姨妈黑色是什么原因 吸顶灯什么牌子的好
烟青色是什么颜色aiwuzhiyu.com 包可以加什么偏旁hcv8jop0ns6r.cn 河南属于什么平原hcv8jop0ns5r.cn 可否是什么意思hcv9jop3ns4r.cn 减肥吃什么药hcv8jop0ns7r.cn
启明星是什么意思hcv9jop6ns2r.cn 周年祭日有什么讲究gysmod.com 昱字五行属什么hanqikai.com 黄桃什么时候上市xscnpatent.com 脾胃虚吃什么hcv9jop4ns8r.cn
挚爱适合用在什么人luyiluode.com 什么是两栖动物adwl56.com 拖鞋买什么材质的好kuyehao.com 截根疗法是什么hcv9jop5ns4r.cn co是什么气体hcv8jop2ns8r.cn
姜为什么不能晚上吃hcv8jop1ns2r.cn 孩子睡觉磨牙是什么原因hcv9jop6ns3r.cn 头皮起疙瘩是什么原因hcv9jop7ns3r.cn 陈皮不能和什么一起吃hcv8jop3ns0r.cn 10.25是什么星座bysq.com
百度