Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(bindings/cpp): init cpp binding #2980

Merged
merged 3 commits into from Aug 31, 2023
Merged

feat(bindings/cpp): init cpp binding #2980

merged 3 commits into from Aug 31, 2023

Conversation

silver-ymz
Copy link
Member

A demo for cpp binding

We use cxx to interop between Rust and C++.

About build system, rust side still use cargo. For better integration with google test, we use cmake and ninja to build c++ code. All build scripts are written in cmake, so ninja can be replaced by make or bazel. I choose it just because it looks like faster.

Example

#include "opendal.hpp"
#include <vector>

int main() {
    auto op = opendal::Operator("memory");
    std::vector<uint8_t> data = {1, 2, 3, 4, 5};
    op.write("test", data);
    auto result = op.read("test");  // result == data
}

Exist Problem

Now I can only build static library, failed to build dynamic library.

Signed-off-by: silver-ymz <yinmingzhuo@gmail.com>
Signed-off-by: silver-ymz <yinmingzhuo@gmail.com>
@silver-ymz silver-ymz changed the title Cpp binding feat(bindings/cpp): init cpp binding Aug 30, 2023
Copy link
Member

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM!

bindings/cpp/README.md Show resolved Hide resolved
bindings/cpp/src/lib.rs Show resolved Hide resolved
Signed-off-by: silver-ymz <yinmingzhuo@gmail.com>
Copy link
Member

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move!

@Xuanwo Xuanwo merged commit 149edd5 into main Aug 31, 2023
19 checks passed
@Xuanwo Xuanwo deleted the cpp-binding branch August 31, 2023 01:55
This was referenced Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants