title: Using Visual Studio DLL in Embarcadero RAD Studio XE?
body: <p>I'm intending to add a spellchecker feature into a VCL Form C++ project in Embarcadero RAD Studio XE.</p>
  
  <p>So far, I succeeded in creating an application that uses hunspell in Visual Studio 2012 following the steps in <a href="https://stackoverflow.com/questions/9703520/c-using-hunspell-1-3-2-with-visual-studio-2010">C++ - Using HunSpell 1.3.2 with Visual Studio 2010</a>. Therefore my first approach was to reuse the .dll created with the VS compiler in RAD Studio.</p>
  
  <pre><code>#include &lt;vcl.h&gt;
  #pragma hdrstop
  
  #include "Unit1.h"
  //---------------------------------------------------------------------------
  #pragma package(smart_init)
  #pragma resource "*.dfm"
  TForm1 *Form1;
  
  
  // dll path
  const wchar_t* library = L"libhunspell.dll";
  
  //  hunspell constructor
  extern "C" __declspec(dllimport) hunspell_initialize(char const * aff,char const * dic);
  
  //adds a word to the loaded dictionary
  extern "C" __declspec(dllimport) int add(char const *) ;
  
  
  //---------------------------------------------------------------------------
  __fastcall TForm1::TForm1(TComponent* Owner)
      : TForm(Owner)
  {
      HINSTANCE load;
      try
      { load = LoadLibrary(library); }
      catch(Exception &amp;e)
      { ShowMessage(e.Message); }
      if (load)
      {
          ShowMessage("Library Loaded!");
  
          hunspell_initialize("de_DE.aff","de_DE.dic");
          add("myword");
      }
      else {ShowMessage ("Library hasn't loaded!");}
  
  
  
  }
  </code></pre>
  
  <p>I can load the library, however the linker is unable to resolve the external functions. </p>
  
  <p>My second approach was to import the hunspell source code and include "hunspell.hxx". However I get a declaration syntax error in the file "csuitl.hxx"</p>
  
  <p>code snippet:</p>
  
  <pre><code>// default flags
  #define DEFAULTFLAGS   65510
  #define FORBIDDENWORD  65510
  #define ONLYUPCASEFLAG 65511
  
  // fopen or optional _wfopen to fix long pathname problem of WIN32
  LIBHUNSPELL_DLL_EXPORTED FILE * myfopen(const char * path, const char * mode); // &lt;&lt; error line
  
  // convert UTF-16 characters to UTF-8
  LIBHUNSPELL_DLL_EXPORTED char * u16_u8(char * dest, int size, const w_char * src, int srclen);
  
  // convert UTF-8 characters to UTF-16
  LIBHUNSPELL_DLL_EXPORTED int u8_u16(w_char * dest, int size, const char * src);
  </code></pre>
  
  <p>I'm wondering, if I'm missing a simple way to include hunspell into my project since it's a widely used tool. Any help is appreciated :)</p>
  
  <p>(hunspell documentation: <a href="http://sourceforge.net/projects/hunspell/files/Hunspell/Documentation/" rel="nofollow noreferrer">http://sourceforge.net/projects/hunspell/files/Hunspell/Documentation/</a>)</p>