gcl.md

00001 # GalilTools {#gcl}
00002 
00003 To provide maximum compatibility, gclib ships with an open source wrapper implementation of the GCL 
00004 (GalilTools Communication Library). Users wanting to upgrade to gclib that have source built on Galil.h
00005 can use this wrapper to minimize source changes. This wrapper is also indicated for users that want the
00006 same function calls as Galil.h, but don't want the usage of <a href="http://qt-project.org/">QT</a>
00007 as in galil1.dll.
00008 
00009 **This wrapper is intended for existing applications already using the library distributed with GalilTools (galil1.dll) 
00010 or the previous *STL* library (galil2.dll). New applications should be written with gclib.**
00011 
00012 <!--- *********************************************************************************** -->
00013 ***
00014 ## Windows
00015 ***
00016 <!--- *********************************************************************************** -->
00017 
00018 ###Compile galil2.dll with MSVC 2013
00019 The following instructions were performed on *Visual Studio Professional 2013* and can be extended to other Visual Studio versions. 
00020 For brevity, the instructions assume the default installation location of **C:\\Program Files (x86)\\Galil\\gclib** and a build type of **x86 (win32)**.
00021 
00022 ###Launch the compiler command prompt
00023 
00024 * Open *VS2013 x86 Native Tools Command Prompt*.
00025 * Navigate to a convenient, writable location, e.g. *C:\\temp*.
00026 
00027 ###Set an environment variable for the base path
00028 
00029     C:\temp>set base=C:\Program Files (x86)\Galil\gclib
00030   
00031 ###Compile the source code
00032 **Note the quotes.**
00033 
00034     C:\temp>cl -c "%base%\source\wrappers\gcl\*.cpp" -I "%base%\include" -EHsc -MD
00035   
00036 ###Link the source code
00037 **Note the quotes.**  
00038 
00039     C:\temp>link /DLL gcl_datarecord.obj gcl_galil.obj "%base%\lib\dynamic\x86\gclib.lib" "%base%\lib\dynamic\x86\gclibo.lib" /OUT:galil2.dll
00040 
00041 The output files *galil2.dll* and *galil2.lib* can now be used in a project using the GCL.
00042 
00043 ###Test
00044 Help the loader find the right dlls.
00045 
00046     C:\temp>set PATH=%PATH%;%BASE%\dll\x86
00047 
00048 Link the simple example.
00049 
00050     C:\temp>link gcl_simple.obj "%base%\lib\dynamic\x86\gclib.lib" "%base%\lib\dynamic\x86\gclibo.lib" galil2.lib /OUT:simple.exe
00051 
00052 Run the example.
00053 
00054     C:\temp>simple.exe
00055     Galil2.dll wrapper, gclib 106.75.180
00056     10.1.3.169, DMC4020 Rev 1.2c, 291
00057 
00058 
00059 <!--- *********************************************************************************** -->
00060 ***
00061 ## Linux
00062 ***
00063 <!--- *********************************************************************************** -->
00064 
00065 ###Copy files
00066 
00067     $ tar -xzf /usr/share/doc/gclib/src/gclib_164_gcl.tar.gz 
00068     $ ls
00069     Galil.h             gcl_galil.cpp  gcl_simple.cpp
00070     gcl_datarecord.cpp  gcl_galil.h    makefile
00071 
00072 ###Make and install
00073 
00074     $ make
00075     gcl open source wrapper for gclib
00076       Compiling wrapper, libgalil.so.2.0
00077     g++ -c -fPIC -std=c++11 gcl_datarecord.cpp  gcl_galil.cpp
00078       Linking wrapper into shared library.
00079     g++ -shared -o libgalil.so.2.0 *.o -Wl,-soname=libgalil.so.2
00080     strip --strip-unneeded libgalil.so.2.0
00081       Cleaning up.
00082     $ sudo make install
00083     Installing libgalil.so.2.0
00084     install -m 755 libgalil.so.2.0 /usr/lib
00085     install -m 644 Galil.h /usr/lib
00086     ldconfig
00087     ln -s /usr/lib/libgalil.so.2 /usr/lib/libgalil.so
00088     $ make clean
00089     Cleaning project...
00090 
00091 ###Test
00092 
00093     $ g++ gcl_simple.cpp -lgalil -lgclib -lgclibo -o simple
00094     $ ./simple
00095     Galil2.dll wrapper, gclib 95.71.164
00096     10.1.3.169, DMC4020 Rev 1.2c, 291
00097 
00098 
00099 
00100 
00101 
00102 
00103 
00104 
00105