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

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.

主站蜘蛛池模板: 马关县| 永清县| 郓城县| 碌曲县| 青冈县| 潢川县| 漳州市| 瑞昌市| 厦门市| 车险| 海伦市| 德化县| 正镶白旗| 元江| 兴文县| 通城县| 怀仁县| 虎林市| 博客| 外汇| 阿城市| 安多县| 新乡县| 清水县| 久治县| 大田县| 花垣县| 潞西市| 铁岭县| 利川市| 始兴县| 金堂县| 柞水县| 读书| 宽甸| 邹城市| 临潭县| 离岛区| 偏关县| 台南市| 金昌市|