官术网_书友最值得收藏!

Linking and interoperability

Rust compiles to native code like many other languages, which is great because it expands the available libraries and lets you choose the best technology to solve a problem. "Playing nice with others" has always been a major design goal of Rust.

Interoperability on that level is as simple as declaring the function that you want to import and dynamically linking a library that exports this function. This process is largely automated: the only thing required is to create and declare a build script that compiles the dependency and then tells the linker where the output is located. Depending on what type of library you built, the linker does what is necessary to include it into the Rust program: static or dynamic linking (the default).

If there is only one native library that is to be linked dynamically, the manifest file offers a links property to specify that. Programmatically, it's very easy to interact with these included libraries by using the Foreign Function Interface.

主站蜘蛛池模板: 安化县| 灵石县| 马边| 鄢陵县| 台山市| 确山县| 青州市| 常熟市| 行唐县| 拉萨市| 台北市| 天峨县| 扶余县| 建始县| 黎平县| 霸州市| 永康市| 临沭县| 菏泽市| 息烽县| 鹿泉市| 大同县| 大方县| 礼泉县| 保定市| 井冈山市| 三亚市| 东明县| 江达县| 铜山县| 灵寿县| 安徽省| 永德县| 肥东县| 潜江市| 伊通| 荆门市| 拉孜县| 嵩明县| 新河县| 新竹市|