15,905,566 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by MorningCloud (Top 13 by date)
MorningCloud
11-Sep-23 6:17am
View
Thanks, Richard, that has fixed the problem.
MorningCloud
11-Sep-23 5:19am
View
Thanks Richard. However, when I change my code to:
if (Hunspell_add != NULL){ Hunspell_add(dic, Word2Add); }
I get the error message "Type error in argument 1 to 'function'; expected 'const char *' but found 'Hunhandle (aka (incomplete) struct Hunhandle) *"
The pdf file "hunspell3.pdf" at https://sourceforge.net/projects/hunspell/files/Hunspell/Documentation/ seems to indicate that when programming in the C language the handle is not needed. It looks as thought there is quite a difference between programming in C++ and in C.
MorningCloud
10-Sep-23 11:29am
View
Thanks, Richard. I am still trying to get this to work but everything I try causes a crash and I can't see why.
I was reluctant to post the full code for my Hunspell program as it is quite large (264 lines) and so I only posted the section that was not working. However, you made me realise that it may help to resolve the problem if I post the full code that includes the part that works (ie check the spelling of a word), so I have made it available in a zip file that can be downloaded from the following link:
https://mega.nz/file/HAsiSKqb#J_wIe_xlnisNj2MXptJ1JzjlIvrWqDx6n7vc_JKrbZU
I have not been able to find out what the return value from Hunspell_add() should be. I can only assume that this is TRUE or FALSE.
MorningCloud
10-Sep-23 8:56am
View
Thanks, I'll take a look at that.
MorningCloud
9-Sep-23 13:23pm
View
Thanks for looking into this. It's very irritating that the documentation is so poor. I spent a lot of time looking in the internet for further information about Hunspell. Although it seems to be widely used there is virtually no information or examples for using it in the C language.
MorningCloud
9-Sep-23 10:09am
View
Strange that it crashes for words larger than 8 characters. I can't see any differences between the code you used and the code I used except you used LoadLibraryW(L"Hunspellx64"); whereas I used LoadLibrary("Hunspellx64.dll");
Unfortunately the documentation is very sparse. This states:
"int add(const char *word);"
...
"The add(), add_with_affix() and remove() are helper functions of a personal dictionary implementation to add and remove words from the base dictionary in run-time."
I find that it crashes on my PC with three lettered words.
MorningCloud
9-Sep-23 9:16am
View
That's strange. I am compiling the program in Windows 11 as a 64-bit exe file using Pelles C. I used the debugger and this reported "Exception: Access violation" although I have no idea why this is happening.
MorningCloud
9-Sep-23 3:39am
View
I don't have the *.lib file for the DLL - I only have the DLL file itself.
MorningCloud
8-Sep-23 14:05pm
View
I tried passing a char* but this also caused the program to crash. My IDE does not give an error code when I run the program from the IDE. I have noted your comments about the debug version and the release version.
MorningCloud
8-Sep-23 13:57pm
View
The library can be downloaded from https://mega.nz/file/iUNWEQyY#QIZgEklHY9iRJrudmBW_vCQT0MdZw8ynJSFkWRtNdZY
I can't remember where I sourced this file, however I do know that it works because I have used it to develop a spelling checker in PureBasic athttp://forums.purebasic.com/english/viewtopic.php?p=561336&hilit=hunspell&sid=15a7d18388871a08322ffbca622f4e4c#p561336
MorningCloud
8-Sep-23 12:42pm
View
According to the documentation hunspell3.pdf at
Hunspell - Browse /Hunspell/Documentation at SourceForge.net
[
^
] the hunspell_add function expects a non-const char*.
The value of hHunspellLib is set up only once in my program and so its value cannot change (unless the Hunspell DLL is making it change, which is very unlikely).
I don't get an exit code when the program crashes. I know how to do this for a console program but I don't know how to do this for a Windows program.
I know that the crash occurs when calling HunspellAdd() because if I comment out that line in my program it does not crash and another function from the Hunspell DLL, Hunspell_spell, works correctly.
MorningCloud
8-Sep-23 12:40pm
View
I tried removing the __fastcall specifier in my typedef as suggested and I also tried changing it to __stdcall but the program still crashed.
MorningCloud is not associated with Ted Heath. This was a member of a tribe in a book I once read and for some reason I decided to use it as my pseudo name.
MorningCloud
8-Sep-23 12:39pm
View
Deleted
Thank you for these quick responses.
I tried removing the __fastcall specifier in my typedef as suggested and I also tried changing it to __stdcall but the program still crashed.
According to the documentation hunspell3.pdf at
Hunspell - Browse /Hunspell/Documentation at SourceForge.net
[
^
] the hunspell_add function expects a non-const char*.
The value of hHunspellLib is set up only once in my program and so its value cannot change (unless the Hunspell DLL is making it change, which is very unlikely).
I don't get an exit code when the program crashes. I know how to do this for a console program but I don't know how to do this for a Windows program.
I know that the crash occurs when calling HunspellAdd() because if I comment out that line in my program it does not crash and another function from the Hunspell DLL, Hunspell_spell, works correctly.
MorningCloud is not associated with Ted Heath. This was a member of a tribe in a book I once read and for some reason I decided to use it as my pseudo name.
Show More