Create shared library build
- Dominant language
- Go
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
This project is intended to be distributed as a shared library that can be called from other languages, this will require building and producing an `so`, `dll` and `dylib` artifact for linux, windows and mac respectively. To achieve this the `C` library needs to be imported at the top of the codebase and an empty main function must be provided;
```go
import "C"
func main() {}
```
Any methods being made available for external calls in the shared library must be annotated with an export comment;
```go
// export Parse
func Parse(input string) map[string]string {
//...
```
Once this is done separate build processes will need to be created to run in github actions;
**Linux**
```sh
go build -o libscry.so -buildmode=c-shared main.go
```
**Windows**
```sh
go build -o libscry.dll -buildmode=c-shared main.go
```
**MacOS**
```sh
go build -o libscry.dylib -buildmode=c-shared main.go
```
These will be bundled up into a release so the relevant artifact can be brought into the user's codebase like this;
**Java**
```java
import com.sun.jna.Native;
//...
GoLibrary goLib = Native.load("libscry", GoLibrary.class);
goLib.Parse("t:instant c:b");
```
**C#**
```cs
[DllImport("libscry.dll")]
public static extern int Parse(string x);
//...
Parse("t:instant c:b");
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating main.go and the current Parse entry point, then run the listed go build commands to verify the shared-library targets. Define GitHub Actions processes for Linux, Windows, and macOS, and confirm that the resulting .so, .dll, and .dylib artifacts are bundled into a release.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, go
- Domain
- build-system, ci-cd, release
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100