From e1beb3e206cc5a9256b5f36317d2b1c2c4626fa8 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 15 Mar 2023 11:00:02 +0800 Subject: [PATCH] It works Signed-off-by: Xuanwo --- bindings/c/.gitignore | 2 ++ bindings/c/Cargo.toml | 17 +++++++++++++++++ bindings/c/cbindgen.toml | 2 +- bindings/c/include/opendal.h | 2 +- bindings/c/src/lib.rs | 17 +++++++++++++++++ bindings/c/tests/Makefile | 5 ++--- bindings/c/tests/hello.c | 18 ++++++++++++++++++ 7 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 bindings/c/.gitignore diff --git a/bindings/c/.gitignore b/bindings/c/.gitignore new file mode 100644 index 00000000000..b6211651bd2 --- /dev/null +++ b/bindings/c/.gitignore @@ -0,0 +1,2 @@ +tests/hello +tests/hello.o diff --git a/bindings/c/Cargo.toml b/bindings/c/Cargo.toml index 13ca111c454..3dab48b85f0 100644 --- a/bindings/c/Cargo.toml +++ b/bindings/c/Cargo.toml @@ -1,3 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + [package] edition = "2021" name = "opendal-c" diff --git a/bindings/c/cbindgen.toml b/bindings/c/cbindgen.toml index 183804aae07..9b4e6c4e185 100644 --- a/bindings/c/cbindgen.toml +++ b/bindings/c/cbindgen.toml @@ -20,7 +20,7 @@ language = "C" header = """ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information diff --git a/bindings/c/include/opendal.h b/bindings/c/include/opendal.h index ca4400fe120..3cd506b4f2b 100644 --- a/bindings/c/include/opendal.h +++ b/bindings/c/include/opendal.h @@ -1,4 +1,4 @@ -/* +/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information diff --git a/bindings/c/src/lib.rs b/bindings/c/src/lib.rs index 8e5164af163..b3f10b17d39 100644 --- a/bindings/c/src/lib.rs +++ b/bindings/c/src/lib.rs @@ -1,3 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + use opendal::{services::Memory, Operator}; /// Hello, OpenDAL! diff --git a/bindings/c/tests/Makefile b/bindings/c/tests/Makefile index 4d4f641ad2c..9ea33ad9d29 100644 --- a/bindings/c/tests/Makefile +++ b/bindings/c/tests/Makefile @@ -2,7 +2,7 @@ # Build the example client # -RPATH=$(PWD)/../../target/debug +RPATH=$(PWD)/../../../target/debug CFLAGS = -I../include LDFLAGS = -L$(RPATH) -Wl,-rpath,$(RPATH) LIBS = -lopendal @@ -10,5 +10,4 @@ LIBS = -lopendal all: build build: - $(CC) hello.c $(CFLAGS) - $(CC) -o hello hello.o $(LDFLAGS) $(LIBS) + $(CC) hello.c -o hello $(CFLAGS) $(LDFLAGS) $(LIBS) diff --git a/bindings/c/tests/hello.c b/bindings/c/tests/hello.c index d8fe22a63c8..4a6d921d468 100644 --- a/bindings/c/tests/hello.c +++ b/bindings/c/tests/hello.c @@ -1,3 +1,21 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ #include "opendal.h" int main(int argc, char *argv[]) {