Reputation: 3801
I'm trying to use the hunspell library in a Go project on Windows.
I have the compiled Windows DLL (x64) and the corresponding header file (which is written in C), but I can't link it to the Go program.
What I've tried so far:
package main
//#cgo CFLAGS: -Id:/Go/HunSpellTest/build/
//#cgo LDFLAGS: -Ld:/Go/HunSpellTest/build/llibhunspell-1.7-0.dll -llibhunspell-1.7-0
// #include <stdlib.h>
// #include <hunspell.h>
import "C"
import (
"unsafe"
)
func main() {
C.Hunspell_create()
}
But with any combination of the paths and filenames (with extension, without extension, without version number, with relative and absolute path, using slashes or backslashes) I got the same error:
undefined reference to __imp_Hunspell_create
I've tried to add that path to the global PATH
variable or put the DLLs into a system wide folder, but nothing worked.
Please note that I can link the DLL with the syscall
package and call the Hunspell_create
method, but I would like to use the lib like in the hunspellgo package.
Upvotes: 0
Views: 3400
Reputation: 191
C.Hunspell_create()
missing const char* affpath
and const char* dpath
parameters.
Maybe you also missing some mingw-w64/msys2/cygwin
deps packages on Windows. hunspellgo seem not tested on Windows. You needs a linux-like building system (such as mingw-w64/msys2/cygwin
) to compile hunspell on Windows. See at https://github.com/hunspell/hunspell#compiling-on-windows . Golang with cgo support on Windows also need some gcc/g++
deps.
Upvotes: 1