# Installation

> The Go package is a cgo layer over the C library, fetched as a module.

`import "github.com/unum-cloud/uform"` 4.0.0-rc.1 · c58749fe

The Go package is a cgo layer over the C library, fetched as a module:

```sh
go get github.com/unum-cloud/uform/golang@main
```

The package includes the headers of its own module’s `c/` folder and links `libuform_static`, which you build from a checkout and name to cgo:

```sh
cmake --preset library && cmake --build --preset library --target uform_static
export CGO_LDFLAGS="-L$PWD/build_library/src -lturbojpeg -lpng -lwebp -lavformat -lavcodec -lavutil -lswresample -lswscale"
```

The archive carries UForm and its bundled libraries, while the system image, video and audio codecs its host decoders call stay shared libraries, which cgo links by name as Rust’s `build.rs` does; the stand-in needs none of them. `-D UFORM_ENCODER_DTYPES=bf16` narrows the block-product dtypes the archive compiles from the default `bf16;e4m3`, and a model load in a left-out one fails with `StatusUnsupported`. `EncoderDTypesCompiled()` answers the kept ones as a mask, bit `n` standing for the `Scalar` valued `n`.

The module carries no version suffix, so pin a branch or a commit, `@main` or `@<commit>`, which `go.sum` locks as a pseudo-version. The suites run against the stand-in library, which answers every verb over the C++ standard library alone:

```sh
cmake --preset stub_library -D UFORM_WITH_CODECS=OFF && cmake --build --preset stub_library --target uform_static_stub
CGO_LDFLAGS="-L$PWD/build_stub_library/stub" go test -race ./golang/...
```

## API

### Functions

#### `EncoderDTypesCompiled`

EncoderDTypesCompiled is the mask of block-product dtypes the linked encoder compiles, bit n standing for the Scalar valued n.

[uform.go:1269 ↗](https://github.com/unum-cloud/UForm/blob/c58749fe4bb208356cc78a87357ab007041c515b/uform.go#L1269)

```go
func EncoderDTypesCompiled() uint64
```

#### `Version`

Version reports the version of the linked library.

[uform.go:1261 ↗](https://github.com/unum-cloud/UForm/blob/c58749fe4bb208356cc78a87357ab007041c515b/uform.go#L1261)

```go
func Version() string
```
