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

Last reviewed: February 22, 1996
Article ID: Q147123
The information in this article applies to:
  • Microsoft Speech Software Development Kit (SDK) version 1.0

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 reference words: 1.00 SAPI VCMD VTXT SR TTS
KBCategory: kb3rdparty kbmm kbprb
KBSubcategory: MMSpeech


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 22, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.