[Update (18/8/10): since I posted this, some revisions to the Hunspell source in the meantime might make it easier to just use the libhunspell project file in the win_api sub-directory. As per my comment in response to Arnold below, this project in the v1.2.11 release builds fine for me ‘as is’.]
As I got asked, I thought I might as well make a separate post out of it, so here goes. To compile a new Hunspell DLL, you could do the following:
- Make sure you have a suitable C++ compiler at the ready. I’ve no idea about C++Builder, but Visual C++ Express does the job fine, and it’s free.
- Make sure you have something like the (open source) 7-ZIP installed so you can open a compressed tarball file (.tar.gz).
- Download the Hunspell source from Hunspell’s Sourceforge homepage.
- Extract said source to a suitable directory. If you inspect the extracted files, you’ll come across more than one MSVC project file — specifically, you should be able to find one for MSVC 6 in src\hunspell (hunspell.dsp) and a MSVC 2005 project group (‘solution’) in src\win_api (Hunspell.sln, hunspell.vcproj, libhunspell.vcproj, testparser.vcproj). Basically, Hunspell is a C++ library, though at some point, a new DLL project file with C exports (the one in win_api) was added to the standard distribution to make using Hunspell with (e.g.) Delphi simpler. Later still however, a C interface with slightly different signatures was added to the main source. Consequently, it doesn’t really matter which project file you choose — my wrapper supports DLLs produced by either. Also, while only the win_api project file is set to create a DLL by default, you’ll still have to fiddle about with it before getting it to compile, and once done, it will create a slightly larger DLL compared to the other one.
- That in mind, load up MSVC Express, go to File|Open|Project/Solution…, and find your way to src\hunspell\hunspell.dsp. Accept the resulting prompt to convert the project file to the newest format.
- Go to Project|Add Existing Item, and from src\hunspell, choose every .cxx and .hxx file. I also suggest adding Hunspell.rc from src\win_api too.
- Go to Project|Properties, select Configuration Properties in the tree view, then All Configurations in the Configurations combo box (the latter lies directly above the tree view). Next, change Configuration Type to Dynamic Library (.dll), before selecting C/C++ in the tree view and setting Additional Include Directories to ..\win_api.
- You should now be able to build the project, which will produce hunspell.dll under src\hunspell\Debug. To create a release build, select the Release configuration (most easily from the combo box immediately to the right of the ‘run’ toolbar button), and rebuild. This should cause another hunspell.dll to be created, only this time under src\hunspell\Release.