It is reasonably easy to build an application which uses Prosody.
You must make the compiler define a pre-processor symbol. For a
command-line compiler, this is normally done with a
"-Dsymbol=value" option. The symbol you
need to define is:
| Symbol | Value | Meaning |
|---|---|---|
TiNGTYPE_LINUX | anything | Use only on Linux Indicates that the component should be built for Linux |
TiNGTYPE_QNX | anything | Use only on QNX Indicates that the component should be built for QNX |
TiNGTYPE_SOL | anything | Use only on Solaris Indicates that the component should be built for Solaris |
TiNGTYPE_WINNT | anything | Use only on Microsoft Windows Indicates that the component should be built for Windows |
In addition, you need to define the symbol TiNG_USE_V6.
You also need to add the Prosody include directory to the list of
include directories for the compiler to search.
For a command-line compiler, this is normally done with a
"-Idirectory" option, so if the Prosody package is in
"D:/Aculab/TiNG-distv432", then the option might be
-I D:/Aculab/TiNG-distv432/include.
Don't forget any other settings which may be required. These typically
include a setting to indicate the the program is multithreaded (for
example, to use POSIX threads you may need to define
_REENTRANT). Of course, not every program is
multithreaded, but since many are, it's much easier
to build everything as multithreaded rather than contend with issues such
as linking with libraries some of which are
single-threaded and others of which are multithreaded.
Remember when building applications which use the Aculab call or
switch drivers that you also need to define any symbols they
require. For example, this means you must also
define the symbol ACU_SOLARIS_SPARC that they require
when building for Solaris. See their documentation for full
details.
For each Prosody API you use, you need add an object file to the program. The file required for each API is specified in the introduction to that API's reference manual. For example, for the Speech processing API you need to link with
apilib/gen-LINUX_V6/TiNGcore.o
(Linux),
apilib/gen-QNX/TiNGcore.o
(QNX),
apilib/gen-SOL_32_V6/TiNGcore.o
(Solaris 32-bit),
apilib/gen-SOL_64_V6/TiNGcore.o
(Solaris 64-bit),
apilib/gen-WINNT_V6/TiNGcore.obj
(Windows).
If Prosody has been installed on your system, you should find that these object files have been built during installation.
In your source code which calls Prosody APIs, you need to include the necessary declarations. For example, for the Speech processing API you would use:
#include "smbesp.h"
The file required for each API is specified in the introduction to that API's reference manual.
Under Microsoft Windows if you want to use Visual Studio, please see the separate document Prosody guide: building applications with Visual Studio for detailed instructions on how to configure projects.
Prosody comes with various programs and the necessary support files to build them, so you can also look at them to see how they are built. The appropriate Makefiles are provided and, for Microsoft Windows, Visual Studio Project files are also provided.
Finally, when debugging your application, you may find the application tracing facility of Prosody to be useful. Consequently, it is highly adviseable to build in an appropriate mechanism for enabling this trace.