1 # Rebuilding gclibo {#gclibo}
3 gclib ships with a compiled version of the open source portion, gclibo. However, if a source modification is desired,
4 the following instructions will help with recompiling this portion of the library.
6 <!--- *********************************************************************************** -->
10 <!--- *********************************************************************************** -->
12 For brevity, these instructions assume the default installation location of **C:\\Program Files (x86)\\Galil\\gclib** and a build type of **x86 (win32)**.
13 The following instructions were performed on *Visual Studio Professional 2013* and can be extended to other Visual Studio versions.
15 Open *VS2013 x86 Native Tools Command Prompt*.
18 Navigate to a convenient, empty, writable location, e.g. *C:\\temp*.
20 ####Set an environment variable for the base path.
22 C:\temp>set base=C:\Program Files (x86)\Galil\gclib
24 ####Copy the source files. **Note the quotes.**
26 C:\temp>copy "%base%\source\gclibo\*.c" .
29 Make any necessary changes. For this example, the GInfo() function was changed from
32 GReturn GCALL GInfo(GCon g, GCStringOut info, GSize info_len)
34 return GUtility(g, G_UTIL_INFO, info, &info_len);
41 GReturn GCALL GInfo(GCon g, GCStringOut info, GSize info_len)
43 strncpy(info, "My controller", info_len);
45 //return GUtility(g, G_UTIL_INFO, info, &info_len);
51 ####Compile the source code. **Note the quotes.**
53 C:\temp>cl -c *.c -I "%base%\include" -DBUILDING_GCLIB
55 ####Link the source code. **Note the quotes.**
57 C:\temp>link /DLL *.obj "%base%\lib\dynamic\x86\gclib.lib" /OUT:gclibo.dll
60 Copy back to the installation location from the file explorer.
62 * Copy gclibo.lib to "C:\Program Files (x86)\Galil\gclib\lib\dynamic\x86"
63 * Copy gclibo.dll to "C:\Program Files (x86)\Galil\gclib\dll\x86"
67 ####Copy simple example
69 C:\temp>copy "%base%\examples\cpp\x_simple.c" .
71 ####Edit GOpen() call as necessary
74 C:\temp>cl x_simple.c "%base%\lib\dynamic\x86\*.lib" -I "%base%\include"
78 C:\temp>set PATH=%base%\dll\x86\;%PATH%
89 response: 355000958.0000
95 <!--- *********************************************************************************** -->
99 <!--- *********************************************************************************** -->
106 $ tar -xvf /usr/share/doc/gclib/src/gclibo_164_src.tar.gz
111 $ cp /usr/include/gclib*.h .
113 arrays.c gclib.h gclibo.h makefile_gclibo
114 gclib_errors.h gclibo.c gclib_record.h
118 Make any necessary changes. For this example, the GInfo() function was changed from
121 GReturn GCALL GInfo(GCon g, GCStringOut info, GSize info_len)
123 return GUtility(g, G_UTIL_INFO, info, &info_len);
130 GReturn GCALL GInfo(GCon g, GCStringOut info, GSize info_len)
132 strncpy(info, "My controller", info_len);
134 //return GUtility(g, G_UTIL_INFO, info, &info_len);
140 $ make -f makefile_gclibo
141 Open source component, libgclibo.so.0.0
142 Compiling open source component.
143 gcc -c -Wall -Werror -fPIC -fvisibility=hidden -DBUILDING_GCLIB -DHAVE_VISIBILITY *.c
144 Linking open source component into shared library.
145 gcc -shared -o libgclibo.so.0.0 *.o -Wl,-soname=libgclibo.so.0
146 strip --strip-unneeded libgclibo.so.0.0
148 $ sudo make install -f makefile_gclibo
149 Installing libgclibo.so.0.0
150 install -m 755 libgclibo.so.0.0 /usr/lib
152 $ make clean -f makefile_gclibo
158 ####Extract simple example
160 $ tar -xzf /usr/share/doc/gclib/src/gclib_examples.tar.gz x_simple.c
162 #### Edit GOpen() call as necessary.
165 $ gcc x_simple.c -Wall -Werror -lgclib -lgclibo -o simple
176 response: 182879322.0000
180 <!--- *********************************************************************************** -->
184 <!--- *********************************************************************************** -->
191 $ tar -xvf /Applications/gclib/source/gclibo_253_src.tar.gz x gclibo.h
195 $ cp /Applications/gclib/include/* .
196 $ cp /Applications/gclib/dylib/gclib.0.dylib .
198 arrays.c gclib.h gclib_record.h gclibo.h
199 gclib.0.dylib gclib_errors.h gclibo.c makefile_gclibo
203 Make any necessary changes. For this example, the GInfo() function was changed from
206 GReturn GCALL GInfo(GCon g, GCStringOut info, GSize info_len)
208 return GUtility(g, G_UTIL_INFO, info, &info_len);
215 GReturn GCALL GInfo(GCon g, GCStringOut info, GSize info_len)
217 strncpy(info, "My controller", info_len);
219 //return GUtility(g, G_UTIL_INFO, info, &info_len);
225 $ make -f makefile_gclibo
226 Open source component, gclibo.0.dylib
227 Compiling open source component.
228 gcc -c -Wall -Werror -fPIC -fvisibility=hidden -DBUILDING_GCLIB -DHAVE_VISIBILITY *.c
229 Linking open source component into shared library.
230 gcc -dynamiclib -o gclibo.0.dylib *.o gclib.0.dylib
231 strip -u -r gclibo.0.dylib
233 $ make install -f makefile_gclibo
234 Installing gclibo.0.dylib
235 cp gclibo.0.dylib /Applications/gclib/dylib
236 $ make clean -f makefile_gclibo
242 ####Extract simple example
244 $ tar -xzf /Applications/gclib/examples/gclib_examples.tar.gz x_simple.c
246 #### Edit GOpen() call as necessary.
249 $ gcc x_simple.c -Wall -Werror gclib.0.dylib gclibo.0.dylib -o simple
260 response: 182879322.0000