gclib ships with a compiled version of the open source portion, gclibo. However, if a source modification is desired, the following instructions will help with recompiling this portion of the library.
For brevity, these instructions assume the default installation location of C:\Program Files (x86)\Galil\gclib and a build type of x86 (win32). The following instructions were performed on Visual Studio Professional 2015 and can be extended to other Visual Studio versions.
Create a working directory. A convenient, empty, writable location, e.g.
C:\>mkdir %homepath%\Desktop\temp
Recompiling gclibo requires the source code for the open source compression library zlib. This can be downloaded from the zlib website: http://zlib.net/zlib1211.zip.
Extract the downloaded zlib source files to the working directory.
Open VS2015 x86 Native Tools Command Prompt and navigate to the working directory.
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC>cd %homepath%\Desktop\temp C:\Users\user\Desktop\temp>dir /b zlib-1.2.11
>set base="C:\Program Files (x86)\Galil\gclib"
>set zlib="%CD%\zlib-1.2.11"
>copy %base%\source\gclibo\*.c . C:\Program Files (x86)\Galil\gclib\source\gclibo\arrays.c C:\Program Files (x86)\Galil\gclib\source\gclibo\gclibo.c 2 file(s) copied.
Make any necessary changes. For this example, the GInfo() function was changed from
to
>cl -c *.c %zlib%\*.c -I %base%\include -I %zlib% -DBUILDING_GCLIB
>link /DLL *.obj %base%\lib\dynamic\x86\gclib.lib /OUT:gclibo.dll
Copy back to the installation location from the file explorer. This will require administrator privileges.
>copy %base%\examples\cpp\x_simple.c .
>cl x_simple.c %base%\lib\dynamic\x86\*.lib -I %base%\include
>set PATH=%base%\dll\x86\;%PATH%
>x_simple.exe rc: 0 version: 85.60.138 rc: 0 rc: 0 info: My controller rc: 0 response: 355000958.0000 :
$ cp -r /usr/share/gclib/src/gclibo . $ cd gclibo $ cp /usr/include/gclib*.h .
Make any necessary changes. For this example, the GInfo() function was changed from
to
# make install -f makefile_gclibo # make clean -f makefile_gclibo
$ cp /usr/share/gclib/doc/examples/cpp/x_examples/x_simple.c .
$ gcc x_simple.c -Wall -Werror -lgclib -lgclibo -o simple
$ ./simple rc: 0 version: 85.60.131 rc: 0 rc: 0 info: My controller rc: 0 response: 182879322.0000 :
$ mkdir test $ cd test $ tar -xvf /Applications/gclib/source/gclibo_src.tar.gz x gclibo.h x gclibo.c x arrays.c x makefile_gclibo $ cp /Applications/gclib/include/* . $ cp /Applications/gclib/dylib/gclib.0.dylib . $ ls arrays.c gclib.h gclib_record.h gclibo.h gclib.0.dylib gclib_errors.h gclibo.c makefile_gclibo
Make any necessary changes. For this example, the GInfo() function was changed from
to
$ make -f makefile_gclibo Open source component, gclibo.0.dylib Compiling open source component. gcc -c -Wall -Werror -fPIC -fvisibility=hidden -DBUILDING_GCLIB -DHAVE_VISIBILITY *.c Linking open source component into shared library. gcc -dynamiclib -o gclibo.0.dylib *.o gclib.0.dylib strip -u -r gclibo.0.dylib Cleaning up. $ make install -f makefile_gclibo Installing gclibo.0.dylib cp gclibo.0.dylib /Applications/gclib/dylib $ make clean -f makefile_gclibo Cleaning project...
$ tar -xzf /Applications/gclib/examples/gclib_examples.tar.gz x_simple.c
$ gcc x_simple.c -Wall -Werror gclib.0.dylib gclibo.0.dylib -o simple
$ ./simple rc: 0 version: 127.110.253 rc: 0 rc: 0 info: My controller rc: 0 response: 182879322.0000 :