0

I try this

name := C.CString("vds")
C.OpenService(scm, (name), C.DWORD(C.SC_MANAGER_ALL_ACCESS))

but it wont compile

.\test.go:28: cannot use name (type *C.char) as type *C.CHAR in argument to _Cfunc_OpenService

I tried looking for similar things (sqlite for example) but they seem to use this same idiom, but it compiles

1 Answer 1

0

Try explicitly casting it:

name := C.CString("vds")
C.OpenService(scm, (*C.CHAR)(unsafe.Pointer(name)), C>DWORD(C.SC_MANAGER_ALL_ACCESS))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.