PRB: Speech.h Does Not Work with the Borland C++ Compiler

ID: Q147123


The information in this article applies to:


SYMPTOMS

The Speech.h header file required to build applications written with the Microsoft Speech SDK version 1.0 is not compatible with the Borland C\C++ compiler at this time. However, it is compatible with Microsoft Visual C++ versions 2.2 and 4.0, as well as the Symantec C++ version 7.2 compiler.

NOTE: Some products mentioned in this article are manufactured by vendors independent of Microsoft; we make no warranty, implied or otherwise, regarding these products' performance or reliability.


CAUSE

Microsoft compilers support a 64-bit integer type, _int64. Borland does not support this type. Also, Borland's compiler does not allow zero-length arrays, which are used in the speech-recognition APIs.


RESOLUTION

_int64 issue:

A workaround has been tried, which does seem to work, though its effectiveness has not been rigorously verified. To implement the workaround, change the following line in Speech.h:


   typedef unsigned _int64 QWORD, * PQWORD; 

to:

   #ifdef __BORLANDC__
   typedef struct _tagQWORD {BYTE abData[8];} QWORD *PQWORD;
   #else
   typedef unsigned _int64 QWORD, *PQWORD;
   #endif //__BORLANDC__ 

Zero length array issue:

Here's an example of the use of a zero length array as used in the speech-recognition APIs:


   typedef struct {

      DWORD    dwSize;
      DWORD    dwUniqueID;
      BYTE     abData[0];

   } SRCFGRULE, * PSRCFGRULE; 


This is not an absolutely blocking problem. Borland's compiler will compile Speech.h if abData[0] is changed to abData[]. However, whether or not this generates the same data structures as Microsoft compilers is unknown at this time, so it is only a solution that is safe for making Speech.h compile. Microsoft has not tested the structures beyond simple build tests and can make no warranties about their effectiveness. The affected structures include: SRCFGRULE, SRCFGIMPRULEW, SRCFGIMPRULEA, SRCFGXRULEW, SRCFGXRULEA, SRCFGLISTW, SRCFGLISTA, SRWORDW, SRWORDA, SRPHRASEW, SRPHRASEA, and SRCHUNK.


STATUS

This behavior demonstrates a design incompatibility between the two products.


MORE INFORMATION

These problems only affect the speech-recognition and text-to-speech APIs. Voice-command and voice-text applications do not use QWORDs or the above- named structures. Therefore, users of the voice-command and voice-text APIs may make these changes, compile, and not worry about the results. If you use the speech-recognition and text-to-speech APIs, you must test the functions that use QWORDS rigorously to be sure that the values are coming out properly, and you must check carefully to ensure that the structures are being properly interpreted.

Additional query words: 1.00 SAPI VCMD VTXT SR TTS


Keywords          : kb3rdparty kbmm MMSpeech 
Version           : 1.00 | 1.00
Platform          : NT WINDOWS 
Issue type        : 

Last Reviewed: March 6, 1999