Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ggdream/bindgo
Use Dart to call Shell, complete the work of compiling Golang CGO code into a so, dll, a, WASM, and etc. And place it in the corresponding source file directory of each Flutter platform.
https://github.com/ggdream/bindgo
android cgo cross-platform dartlang dynamic-link-library ffi flutter fuchsia-os golang ios linux macos web windows
Last synced: 1 day ago
JSON representation
Use Dart to call Shell, complete the work of compiling Golang CGO code into a so, dll, a, WASM, and etc. And place it in the corresponding source file directory of each Flutter platform.
- Host: GitHub
- URL: https://github.com/ggdream/bindgo
- Owner: ggdream
- License: mit
- Created: 2021-10-11T12:10:52.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-10-12T07:35:50.000Z (over 3 years ago)
- Last Synced: 2023-08-20T21:28:27.113Z (over 1 year ago)
- Topics: android, cgo, cross-platform, dartlang, dynamic-link-library, ffi, flutter, fuchsia-os, golang, ios, linux, macos, web, windows
- Language: Dart
- Homepage:
- Size: 217 KB
- Stars: 37
- Watchers: 5
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# BindGo
Use Dart to call Shell, complete the work of compiling Golang CGO code into a so, dll, a, WASM, and etc. And place it in the corresponding source file directory of each Flutter platform.
## Getting started
First, add `bindgo` as a dev dependency in your pubspec.yaml file. It belongs in dev_dependencies because it is a command line tool.
```yaml
dev_dependencies:
bindgo: any
```## Usage
1. Adding your config to field `bindgo` in pubspec.yaml
e.g. :
```yaml
bindgo:
name: test # Dynamic library output name
main: ./test # The directory where the main package of golang code is located
platforms:
windows:
arch:
- 'amd64'
android:
arch:
- 'arm64'
cc: '${NDK}/toolchains/llvm/prebuilt/windows-x86_64/bin/aarch64-linux-android27-clang.cmd'
```2. Run the following command in the terminal
```bash
dart run bindgo
```or
```bash
flutter pub run bindgo:run
```## Additional information
View the operating systems and architectures supported by the current version of golang:
```bash
go tool dist list
```e.g. :
```bash
# golang v1.17.2...
android/386
android/amd64
android/arm
android/arm64
---
darwin/amd64
darwin/arm64
...
ios/amd64
ios/arm64
---
js/wasm
---
linux/386
linux/amd64
linux/arm
linux/arm64
...
windows/386
windows/amd64
windows/arm
windows/arm64
```