I am looking to convert a [32]C.wchar_t
to a go string.
The array is defined as follows in the dll
I am talking to:
typedef struct myStruct {
WCHAR someString[32];
}
I am defining the struct in go as follows:
type myStruct struct {
someString [32]C.wchar_t
}
I have a method in the dll
:
DLLINTERFACE HRESULT __stdcall GetMyStruct (myStruct* ptrMyStruct);
This method will populate the someString
field of myStruct
.
I am calling the method like so (this is working correctly, I think, I have not been able to see the contents of someString
):
func getMyStruct() (*myStruct, uintptr) {
var getMyStruct = dll.MustFindProc("GetMyStruct")
var args = new(myStruct)
ret, _, _ := getMyStruct .Call(uintptr(unsafe.Pointer(args)))
fmt.Printf("Return: %d
", (int)(ret))
return args, ret
}
I need to convert someString
to a go string. I have tried using "github.com/GeertJohan/cgo.wchar"
, but it does not have a method for converting []C.whar_t
to go string.
Currently I'm not sure if my go struct is correct. I'm also not sure if I am initializing myStruct
correctly before sending it to the dll.
Any help will be greatly appreciated.