Hey there
I have a problem wirh one of my modules. Basicly it can’t find my *.dll file that I included into the module. The problem is if I try to use the module in one of my other modules I get a error.
I have the following file structure:
- yjuqsoft
-- lua53
--- go.mod
--- lua.go
--- lua53.dll
-- test
--- go.mod
--- main.go
Here the content of the files:
yjuqsoft/lua53/go.mod
module yjuqsoft/lua53
go 1.14
require golang.org/x/sys v0.0.0-20200331124033-c3d80250170d
yjuqsoft/lua53/lua.go
package lua53
import (
"fmt"
"golang.org/x/sys/windows"
)
var dll *windows.DLL
func init() {
tmp, err := windows.LoadDLL("lua53.dll") // problematic line
dll = tmp
fmt.Println(err)
}
// DllRelease unloads DLL from memory
func DllRelease() {
dll.Release()
}
yjuqsoft/test/go.mod
module yjuqsoft/test
go 1.14
require yjuqsoft/lua53 v0.0.0
replace yjuqsoft/lua53 => ../lua53
yjuqsoft/test/main.go
package main
import _ "yjuqsoft/lua53"
func main() {
// lua53.DllRelease()
}
If I gonna run this, I get the following output: Failed to load lua53.dll: The specified module could not be found.
All right,… The module can’t be found. If I use an absolute path everything works fine. But I don’t want to do that since my module yjuqsoft/lua53 should be independent. So, how do I gonna solve that?
By the way, all files are stored on a usb stick. The GOPATH didn’t point to this USB Stick. If it matters for some reasons.