This section details how to get started using the GalilTools Communication Library with step-by-step examples that show how to print a controller's connection information (e.g. "GALILPCI1, DMC1886 Rev 1.0b, 36") using popular programming languages. See the Hello Galil project on Galil's website for a complete list of examples.
Make sure GalilTools is installed and a connection to the controller can be established from that application. A try-catch error handler is required for most Galil functions, but is left out here for brevity. Please see the Library Reference.
Visual Studio or the free-of-charge Express edition may be used (below configures Visual Studio 2008, but versions back to 6 may be used)
Select Start | All Programs | Microsoft Visual Studio 2008 | Microsoft Visual Studio 2008
Select File | New | Project... | Other Languages | Visual Basic | Windows Forms Application and click OK
Select Project | Add Reference...
Choose the COM tab, select Galil, and click OK
Double click on Form1 and add the code below
Hit F5 to run the program
Visual Studio or the free-of-charge Express edition may be used (below configures Visual Studio 2008, but versions back to 2002 may be used)
Select Start | All Programs | Microsoft Visual Studio 2008 | Microsoft Visual Studio 2008
Select File | New | Project... | Other Languages | Visual C# | Windows Forms Application and click OK
Select Project | Add Reference...
Choose the COM tab, select Galil, and click OK
Double click on Form1 and add the code below
Hit F5 to run the program
Visual Studio or the free-of-charge Express edition may be used (below configures Visual Studio 2008, but 2005 may also be used). This section covers C++/CLI (Common Language Infrastructure) targeting the CLR (Common Language Runtime). For native (unmanaged) C++, see Visual C++ 2008
Select Start | All Programs | Microsoft Visual Studio 2008 | Microsoft Visual Studio 2008 | File | New | Project... | Visual C++ | CLR | Windows Forms Application and click OK
Select Project | Properties... | Add New Reference...
Choose the COM tab, select Galil, and click OK
Double click on Form1 and add the code below
Hit F5 to run the program
Visual Studio or the free-of-charge Express edition may be used (contact Galil if another C++ compiler is required). This section covers native C++. For managed C++, see C++/CLI
Start | All Programs | Microsoft Visual Studio 2008 | Visual Studio Tools | Visual Studio 2008 Command Prompt
C:\Program Files\Microsoft Visual Studio 9.0\VC>cd %ProgramFiles%\Galil\GalilTools\lib
C:\Program Files\Galil\GalilTools\lib>cl hello.cpp Galil1.lib /EHsc /MD Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. hello.cpp Microsoft (R) Incremental Linker Version 9.00.21022.08 Copyright (C) Microsoft Corporation. All rights reserved. /out:hello.exe hello.obj Galil1.lib
C:\Program Files\Galil\GalilTools\bin>set path=%path%;%ProgramFiles%\Galil\GalilTools\bin
C:\Program Files\Galil\GalilTools\lib>hello 1.1.0.4 Aug 29 2008 14:15:14 Galil1.dll GALILPCI2, DMC1886 Rev 1.0b, 988 ...
Note: GalilTools ships with release libraries (/MD switch above). In order to use debug (/MDd) the user MUST download the debug version of the Galil lib.
Debug libraries and libraries for other versions of Visual Studio are available in the GalilTools archive: http://www.galil.com/support/downloads/software/galiltools/windows/
[dj@localhost Galil]$ cd lib
[dj@localhost lib]$ g++ hello.cpp -L. libGalil.so
[dj@localhost lib]$ ./a.out 1.1.0.4 Aug 29 2008 14:15:14 libGalil.so /dev/galilpci0, DMC1886 Rev 1.0b, 988 ...