For more usage examples of both interfaces, please refer to the demo.
Golang Binding Code
This project uses the c-for-go tool to convert the mxsml interface files (written in C) into Go (Golang) format.
Moreover, a number of wrappers have been added on this basis to better align with Go’s idiomatic style.
Typically, the code generated by c-for-go does not need to be updated unless the mxsml header files are modified.
Code Structure
There are two top-level directories in this repository:
/demo
/gen
/pkg
The /demo directory contains examples corresponding to the two sets of interfaces.
The /gen directory contains the header files and rule YAML files dependent on the c-for-go tool.
The /pkg directory contains the Go files converted by c-for-go and the manually encapsulated wrapper files.
Generate Binding Code
$ make gen
$ make gen-extension
Build demo
$ make demo
Execute demo
./demo/bin/mxsmlDemo
./demo/bin/mxsmlExtDemo
Note: To use the go-mxsml interface, ensure that the mxsml dynamic library exists in one of the following paths.
/opt/mxdriver/lib/libmxsml.so
/opt/maca/lib/libmxsml.so
/opt/mxn100/lib/libmxsml.so
关于
Go bindings for the MetaX System Management Library(MXSML)
go-mxsml
Overview
This repository provides Go bindings for the [MetaX System Management Library(MXSML)]
Quick Start
This repository provides two sets of go-mxsml interfaces:
The following example demonstrates how to retrieve the number of current devices and the driver version of device.
The output of this example may be:
For more usage examples of both interfaces, please refer to the demo.
Golang Binding Code
This project uses the c-for-go tool to convert the mxsml interface files (written in C) into Go (Golang) format. Moreover, a number of wrappers have been added on this basis to better align with Go’s idiomatic style. Typically, the code generated by c-for-go does not need to be updated unless the mxsml header files are modified.
Code Structure
There are two top-level directories in this repository:
/demo/gen/pkgThe
/demodirectory contains examples corresponding to the two sets of interfaces. The/gendirectory contains the header files and rule YAML files dependent on the c-for-go tool. The/pkgdirectory contains the Go files converted by c-for-go and the manually encapsulated wrapper files.Generate Binding Code
$ make gen$ make gen-extensionBuild demo
$ make demoExecute demo
./demo/bin/mxsmlDemo./demo/bin/mxsmlExtDemoNote: To use the go-mxsml interface, ensure that the mxsml dynamic library exists in one of the following paths.
/opt/mxdriver/lib/libmxsml.so/opt/maca/lib/libmxsml.so/opt/mxn100/lib/libmxsml.so