Compiling HTS Engine for the CLR

For a project I would really like to be able to get HTS Engine to run Silverlight. Managed c++ isn’t supported in Silverlight, I’m trying to think of other ways to compile it to MSIL.

The first technique I have tried is to compile it as managed c++ and then to try and convert the MSIL to C# and recompile again for Silverlight. It seems as this won’t work because of the dependencies on unmanaged functions such as fopen. However it might be useful for someone who wants to create a .NET compatible library for use in .NET programs on the desktop CLT

  1. First grab the hts_engine source code and unpack
  2. Rename the c file to cpp
  3. Edit the makefile.mak in lib and bin dirs and add the /CLR CFLAG and change /TC to /TP. In the bin/makefile.mak change .c to .cpp.
  4. Copy HTS_engine.h into the lib and bin dirs
  5. Open the Visual Studio command prompt and cd into the hts_engine dir
  6. nmake –f makefile.mak all

If the process worked you can verify it is managed compatible by looking at hts_engine.exe in ildasm


Other options are I though to try next for a fully managed port are:

  • A C++ to C# converter
  • MSIL backend for LLVM

This entry was posted by Edobashira. Bookmark the permalink.

3 thoughts on “Compiling HTS Engine for the CLR”

Leave a Reply

Note: only a member of this blog may post a comment.