Skip to content

feat: Add basic support for bindings/go using CGO#3204

Merged
Xuanwo merged 1 commit intoapache:mainfrom
jiaoew1991:cgo-demo
Sep 28, 2023
Merged

feat: Add basic support for bindings/go using CGO#3204
Xuanwo merged 1 commit intoapache:mainfrom
jiaoew1991:cgo-demo

Conversation

@jiaoew1991
Copy link
Copy Markdown
Contributor

This demo attempts to provide Go bindings by CGO, referring to the writing style of https://github.com/confluentinc/confluent-kafka-go/blob/master/kafka/build_dynamic.go.

To run the test, follow these steps:

  1. Write an opendal_c.pc file, for example:
libdir=/path/to/opendal/target/debug/
includedir=/path/to/opendal/bindings/c/include/

Name: opendal_c
Description: opendal c binding
Version:

Libs: -L${libdir} -lopendal_c
Cflags: -I${includedir}
  1. Set the PKG_CONFIG_PATH environment variable to include the path of opendal_c.pc, for example:
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:/path/to/opendal_c.pc/"
  1. Run go test:
go test -tags dynamic .

@Xuanwo
Copy link
Copy Markdown
Member

Xuanwo commented Sep 28, 2023

  1. Write an opendal_c.pc file

Learnt a lot.

Copy link
Copy Markdown
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.

Cool, let's do this.

Comment thread bindings/go/build_dynamic.go
@Xuanwo Xuanwo changed the title Demo for bindings/go using CGO feat: Add basic support for bindings/go using CGO Sep 28, 2023
@github-actions github-actions Bot added the releases-note/feat The PR implements a new feature or has a title that begins with "feat" label Sep 28, 2023
Copy link
Copy Markdown
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.

Thanks a lot, let's go!

@Xuanwo Xuanwo merged commit e7b4fbd into apache:main Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

releases-note/feat The PR implements a new feature or has a title that begins with "feat"

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants