Comments (1)
So far I am not decided on supporting raw pointers, but currently leaning against. I'd like to see if we can instead specialize toward interfaces that are structured to make it possible to always decide "is this code correct" without looking at the other language.
So in the context of your use case in https://github.com/Michael-F-Bryan/cxx-experiment/blob/1695c0f0d74f045ebfd0565a4d33d9b3222ccb03/src/lib.rs maybe something like one of these options:
#[cxx::bridge]
mod ffi {
extern "C" {
fn bzlib_version_equals(expected: &str) -> bool;
}
}
// c++
bool bzlib_version_equals(RustStr expected) {
auto actual = BZ2_bzlibVersion();
return strncmp(actual, expected.data(), expected.size()) == 0
&& actual[expected.size()] == '\0';
}
// rust
assert!(ffi::bzlib_version_equals("1.0.8, 13-Jul-2019"));
#[cxx::bridge]
mod ffi {
extern "C" {
fn bzlib_version() -> String;
}
}
// c++
RustString bzlib_version() {
return RustString(BZ2_bzlibVersion());
}
from cxx.
Related Issues (20)
- how to get a MSVCRTD-based debug-build LIB on Windows
- Allow empty shared structs
- [help] incorrect rust u8 to uint8_t HOT 1
- How to add lib.rs to a cxx bin crate package? HOT 4
- How can I fuzz cxx?
- Emit with relative symlinks? HOT 1
- cxx bridge error: Failed to copy cxx.h on Windows HOT 2
- bazel rust_cxx_bridge still uses c++11 in compilation HOT 1
- Now `cxx` doesn't support `rust::Vec<rust::Vec<T>>`
- Can't bind to template
- rustc-link-search isn't working HOT 1
- Upgrade to cxx-1.0.103 failing our builds HOT 3
- Consider implementing an inherent `write_fmt` method on CxxString
- Using g++ and -Wmissing-declarations produces warning in generated C++ code HOT 4
- Using C++ classes and methods in Rust. HOT 1
- Looks like none of C++ code generated is linked properly HOT 1
- Question about defining types that are simple structs on the C++ side HOT 2
- Undefined symbols for architecture arm64: "rust::cxxbridge1::Str::Str(char const*)" HOT 4
- panic when trying to build a string from a Windows call HOT 1
- Pass a vector of boxed values from Rust to C++
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cxx.