Could not initiate Hunspellx64.dll in Delphi

Viewed 47

I need to call Hunspell on 64 bit Delphi application. Hunspellx64.dllI is successfully loaded, but it fails to create a Hunspell instance:

procedure TForm5.Button1Click(Sender: TObject);
var
  HunLibHandle: THandle;
  fHunHandle: Pointer;
  Aff, Dic: TFileName;
begin
  HunLibHandle := LoadLibrary('Hunspellx64.dll');

  if HunLibHandle = 0 then
  begin
    ShowMessage('Error loading Hunspellx64.dll ');
    exit;
  end;

  Hunspell_create := THunspell_create(GetProcAddress(HunLibHandle, 'Hunspell_create'));
  if not Assigned(Hunspell_create) then
  begin
    ShowMessage('Error creating Hunspell ');
    exit;
  end;

  Aff := ExtractFilePath(Application.ExeName) + 'en_US.aff';
  Dic := ExtractFilePath(Application.ExeName) + 'en_US.dic';
  fHunHandle := Hunspell_create(pointer(Aff), pointer(Dic));

  ShowMessage('success');

  FreeLibrary(HunLibHandle);

end;

Could you please help me to resolve the problem?

0 Answers
Related