The Galil Communications Library (gclib) is a C API that allows users to connect to and communicate with Galil controllers. Galil provides multiple wrappers around gclib, allowing for use in C++, Python, Java, C#, Visual Basic, or LabVIEW projects.
Installation
All languages require the underlying C library to be installed.
Windows Linux
Quickstart
Follow the instructions to build a simple example program using gclib.
- C/C++
- Windows
- Install CMake.
- Install one of the supported compilers:
- MSVC 14.0 (Visual Studio 2015) or later
- MinGW 8.1 or later
- Compile and run the Hello World example:
> cmake -S "%GCLIB_ROOT%\examples\c" -B build
> cd build
> cmake --build .
> .\hello-world.exe
gclib version is 2.1.20 2.1.20
Hello World!
- Linux
- Install CMake and gcc.
| RHEL / CentOS Stream / Fedora / Rocky | Ubuntu / Debian / Raspberry Pi OS |
$ sudo dnf install cmake gcc | $ sudo apt install cmake gcc |
- Compile and run the Hello World program:
$ cmake -S /usr/share/gclib/examples/c -B build
$ cd build
$ cmake --build .
$ ./hello-world
gclib version is 2.1.20 2.1.20
Hello World!
- Python
- Windows
> py -m pip install https://www.galil.com/sw/pub/python/gclib-1.0.0-py3-none-any.whl
> copy "%GCLIB_ROOT%\examples\python\*" .
> py
>>> import gclib
>>> gclib.py().GVersion()
'py.2.1.20 2.1.20'
- Linux
$ python3 -m venv gclib
$ source gclib/bin/activate
(gclib) $ pip install https://www.galil.com/sw/pub/python/gclib-1.0.0-py3-none-any.whl
(gclib) $ cp /usr/share/gclib/examples/python/* .
(gclib) $ python
>>> import gclib
>>> gclib.py().GVersion()
'py.2.1.20 2.1.20'
- Java To compile Java programs, ensure the JDK is installed, as the JRE does not provide a Java compiler.
- Windows
> curl -O https://www.galil.com/sw/pub/java/gclib-java-1.0.0.tar
> tar -xvf gclib-java-1.0.0.tar
> cd gclib-java-1.0.0
> set CLASSPATH=.;.\*;lib\*
> robocopy "%GCLIB_ROOT%\examples\java" examples
> javac examples\* -d .
> java HelloWorld
gclib version is 2.1.20 2.1.20
Hello World!
- Linux
$ curl -O https://www.galil.com/sw/pub/java/gclib-java-1.0.0.tar
$ tar -xvf gclib-java-1.0.0.tar
$ cd gclib-java-1.0.0
$ export CLASSPATH=.:./*:lib/*
$ javac /usr/share/gclib/examples/java/* -d .
$ java HelloWorld
gclib version is 2.1.20 2.1.20
Hello World!
- C#
> curl -O https://www.galil.com/sw/pub/dotnet/gclib-dotnet.1.0.0.nupkg
> dotnet nuget add source %cd% --name gclib
> robocopy /e "%GCLIB_ROOT%\examples\cs" examples
> cd examples
> dotnet run --project HelloWorld
gclib version is 2.1.20 2.1.20
Hello World!
- VB
> curl -O https://www.galil.com/sw/pub/dotnet/gclib-dotnet.1.0.0.nupkg
> dotnet nuget add source %cd% --name gclib
> robocopy /e "%GCLIB_ROOT%\examples\vb" examples
> cd examples
> dotnet run --project HelloWorld
gclib version is 2.1.20 2.1.20
Hello World!
LabVIEW
Download
- Right click the downloaded file and choose "Add to VIPM Library".
- Choose "Add To Library & Install" when prompted.
- Search for
gclib in the package list, then double click on it to bring up the package info.
- To see all available functions, click "Show in Palettes"
- To see all example VIs, click "Show Examples"