![]() |
![]() |
|
STLSOFT
environment variable to be the root directory of the STLSoft include files, and the CSTRING_ROOT
environment variable to be the root of the cstring installation. In addition, you will need to have built the cstring libraries for your compiler (e.g. cstring.3.dm.debug.lib and cstring.3.dm.lib), using the makefiles provided in the cstring distribution.
The distribution is in the form of a zip file, e.g. shwild-0.9.1.zip
which you should extract (recursively) to a location of your choice, e.g. c:\opensrc\shwild\0.9, or ~/opensrc/shwild/0.9, which will be referred to in the subsequent documentation as <SHWILD-install-dir>
.
build
directory. For example, the makefile for Borland C/C++ v5.6 is in build/vc6
. Since Borland is only supported on Windows, there is a single makefile called makefile
.Hence, to build shwild for Borland C/C++ 5.6 you need open a Windows command box (with the environment set up for the compiler and linker) and execute the following command:
<SHWILD-install-dir>\build\bc56> make -f makefile
or just:
<SHWILD-install-dir>\build\bc56> make
<SHWILD-install-dir>
/build/gcc34
) both makefile.unix
and makefile.win32
are provided. Most make
tools require that you explicitly specify the makefile name (using -f
) to use such makefiles, e.g. make -f makefile.unix
.STLSOFT
and CSTRING_ROOT
: it specifies -I%STLSOFT%/include -I%CSTRING_ROOT%/include
(Windows) / -I$STLSOFT/include -I$CSTRING_ROOT/include
(UNIX) to the compiler, and %CSTRING_ROOT%/lib
(Windows) / $CSTRING_ROOT/lib
(UNIX) to the linker.
Just open the workspace file shwild_vc6.dsw
, located in the root directory (i.e. <SHWILD-install-dir>
), and select the Build-All option.
STLSOFT
and CSTRING_ROOT
environment variables set up correctly.
For example, if you are using the Borland compiler, version 5.6, you would link to the libraries shwild.0.bc56.debug.lib
and cstring.3.bc56.debug.lib
in a debug build and shwild.0.bc56.lib
cstring.3.bc56.lib
in a release build. Say you wish to compile and build the example_c_1.c sample, that resides in <SHWILD-install-dir>
\samples\c\example_c_1.c.
You could compile it:
<SHWILD-install-dir>\samples\c\example_c_1.c6> bcc32 -c -I..\..\..\include
and then link it:
<SHWILD-install-dir>\samples\c\example_c_1.c6> bcc32 -L..\..\..\lib -L%CSTRING_ROOT%\lib example_c_1.obj shwild.0.bc56.lib cstring.3.bc56.lib
With most compilers, you can do this in one step, as in:
<SHWILD-install-dir>\samples\c\example_c_1.c6> bcc32 -I..\..\..\include -L..\..\..\lib -L%CSTRING_ROOT%\lib example_c_1.c shwild.0.bc56.lib cstring.3.bc56.lib
#include
the files <shwild/implicit_link.h>
and <cstring/implicit_link.h>
in the file that is using the shwild library, as in:
#include <shwild/shwild.h> #include <shwild/implicit_link.h> #include <cstring/implicit_link.h> int main() { shwild_match("1?2", "122", 0); return 0; }
When you compile and link this file you will not have to specify the library name. You will still have to specify the library path, however, if it is not in the default linker path(s) for your compiler/linker. The above example reduces to:
<SHWILD-install-dir>\samples\c\example_c_1.c6> bcc32 -I..\..\..\include -I%CSTRING_ROOT%\include -L..\..\..\lib -L%CSTRING_ROOT%\lib example_c_1.c
but not to:
<SHWILD-install-dir>\samples\c\example_c_1.c6> bcc32 -I..\..\..\include -I%CSTRING_ROOT%\include example_c_1.c
(whereupon the compiler will complain about not knowing the location of shwild.0.bc56.lib
or cstring.3.bc56.lib
).
There are two advantages of implicit linking:
|
|
shwild Library documentation © Matthew Wilson and Sean Kelly, 2004-2006 |
|