Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to call C++ 's tool from Rust

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to call C++ tools from Rust". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to call C++ tools from Rust".

Google/autocxx-highly automated rust calls cantilevered, and secure, Fashion this project is a tool for invoking C++ from Rust, in a highly automated but secure way. The goal is to have all the smooth security from the cxx while using a variant of bindgen to automatically generate the interface from the existing C++ header files. Think of autocxx as the glue that inserts bindgen into cxx. Its goal is to eventually expose a procedure macro as follows: class Bob {

Public:

Bob (std::string name)

...

Void do_a_thing ()

}

Use autocxx::include_cxx

Include_cxx! (

Header ("base/bob.h")

Allow ("Bob")

)

Let a = ffi::base::bob::make_unique ("hello" .into ())

A.do_a_thing ()

Using rust is important in the kernel printprint. If something doesn't work, you want to know why (for example, by looking at the console output). When I first wrote log macros for kernel drivers, I didn't think much about security. I just thought, "I'm sure no one will call it with the wrong format specifier or the wrong number of parameters, because it's simple and direct." Thank you for your reading, the above is the content of "how to call C++ tools from Rust". After the study of this article, I believe you have a deeper understanding of how to call C++ tools from Rust, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report