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

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.

主站蜘蛛池模板: 尤溪县| 祁连县| 桦川县| 泾阳县| 云霄县| 杂多县| 柏乡县| 宿迁市| 十堰市| 墨竹工卡县| 双峰县| 沙河市| 靖边县| 昌乐县| 辰溪县| 宝兴县| 徐闻县| 霍邱县| 图们市| 鄂州市| 延津县| 叙永县| 舞钢市| 商水县| 锡林浩特市| 抚顺县| 酒泉市| 璧山县| 潞西市| 沅陵县| 乌海市| 万盛区| 浮山县| 封开县| 阿勒泰市| 浠水县| 聂拉木县| 松阳县| 韩城市| 丹东市| 黑龙江省|