exit status 0xc0000135
wlwatkins opened this issue · comments
I managed to install libzmq using https://github.com/zeromq/czmq#windows
I set my env var as
set CGO_CFLAGS=-IC:/dev/vcpkg/installed/x64-windows/include
set CGO_LDFLAGS=-LC:/dev/vcpkg/installed/x64-windows/lib -l:libzmq-mt-4_3_4.lib
yet I get exit status 0xc0000135 when I run a simple zmq test
package main
import (
"fmt"
zmq4 "github.com/pebbe/zmq4"
)
func startServer(port int) *zmq4.Socket {
// Socket to talk to clients
responder, _ := zmq4.NewSocket(zmq4.Type(zmq4.REP))
url := fmt.Sprintf("tcp://*:%v", port)
responder.Bind(url)
return responder
}
func ZmqServer(port int) {
responder := startServer(port)
defer responder.Close()
kill := true
for kill {
// Wait for next request from client
recv, _ := responder.Recv(0)
switch {
case recv == "1":
responder.Send("1", 0)
case recv == "kill":
kill = false
break
}
}
}
func main() {
ZmqServer(233)
}
Ok, after a day of pulling my hair.
All I need to do is add C:\dev\vcpkg\installed\x64-windows\bin
to my PATH in windows' env. variables. and now after rebooting vscode, it finds the dll.
I don't understand. (I don't know windows.) Isn't PATH for executables, not for libraries? It looks like an issue with the configuration of vscode. Can you provide a full working configuration for vscode?
I believe PATH is used to allow access to executables but also dll. in the case of libzmq, the CGO_LDFLEG is used to indicate the path to the libzmq.lib file, but trying to run it, as indicated, yields the 0xc0000135
which according to a google search means STATUS_DLL_NOT_FOUND
. This is because, by default, vcpkg does not include the \bin path in the env. var PATH. Hence, adding this makes everything work.
yes, the dll(zeromq.dll) must be included in windows env, it will work!