Spellex Windows SDK Technical Support

Using Spellex Windows SDK with C#

Product: Spellex Spell Checking Engine Windows SDK, Version 5.15 and earlier

The following declarations may help customers who need to integrate Spellex into a C# application.

Function declarations

API functions documented in the Spellex Programmer's Guide are shown in C/C++ syntax. The following table shows how to translate C/C++ data types into C# data types:

Open table in new window

For pointer-type parameters (denoted by "*", as in SSCE_CHAR *str) the keyword "const" indicates that the parameter is passed by reference but will not be modified by the called function. If "const" is missing, the parameter is either an output parameter (meaning it is modified to by the called function) or an input/output parameter (meaning its value is read by the called function and may be modified by the called function).

By default, C# uses wide (2-byte) character strings, but the Spellex DLL uses single byte strings. For this reason, the [MarshalAs(UnmanagedType.LPStr)] modifier should be applied to string-type parameters (both input and output).

Following are some example function declarations:

  • [DllImport(@"ssce5432.dll")] public static extern short SSCE_SetKey(ulong key);
     
  • [DllImport(@"ssce5432.dll")] public static extern short SSCE_GetSid();
     
  • [DllImport(@"ssce5432.dll")] public static extern short SSCE_CheckString(short sid,
       [MarshalAs(UnmanagedType.LPStr)] string str, ref int cursor,
       [MarshalAs(UnmanagedType.LPStr)] StringBuilder errWord, short errWordSz,
       [MarshalAs(UnmanagedType.LPStr)] StringBuilder otherWord, short otherWordSz);

(Note that references to ssce5432.dll should be changed to the name of the Spellex DLL included with your version of the Spellex Windows SDK.)

For more information on calling DLLs from C#, search MSDN for "Platform Invoke Tutorial."

Home | Order Now | Products | Upgrades | Free Trial | Partners | About Spellex | Contact Us | Site Map | Privacy Policy

Spellex Corporation © 2008. All rights reserved