Issue with lexactivator function's parameter passing

Currently, I’m working on cryptlex integration with Golang. When I’m trying to build the provided LexActivator sample from GitHub (https://github.com/cryptlex/lexactivator-go/tree/master/examples), getting the following error:
“cannot use _Cfunc_CString(” < Included product data here > “) (type *_Ctype_char) as type *_Ctype_ushort in argument to _Cfunc_SetProductData”.

I have downloaded LexActivator for Windows 3.9.1 and copied “LexActivator.dll” and “LexActivator.lib” in the “libs” directory.

Installed Go version: 1.14

It looks like a typecasting issue while passing the parameter to the LexActivator function. How to resolve this issue?

Also, raised the same issue in GitHub. Please find the following issue link: https://github.com/cryptlex/lexactivator-go/issues/1

Hi,

Which C/C++ compiler are you using on Windows?

Regards,
Adnan

Currently I’m using “TDM-GCC-64” compiler (https://jmeubank.github.io/tdm-gcc/).

Also tried with “MinGW-w64” compiler, but getting same issue.

The issue is that on Windows, all the strings use wchar instead of char. C.Cstring() returns a char string. You need to pass a wchar string.

Did you try:

Hi Adnan,

Thank you for the prompt response.
Tried using “FromGoString” function to convert to “wchar” as suggested (https://godoc.org/github.com/GeertJohan/cgo.wchar#FromGoString), still getting the following error.
“cannot use < Included product data here > (type wchar.WcharString) as type *_Ctype_ushort in argument to _Cfunc_SetProductData”

It looks like the SetProductData function expects *_Ctype_ushort as the parameter. Please let us know how to get past the issue.

We are looking into this issue. Will keep you posted.

Thank you for the update

We have written a new go package for lexactivator which works on all the platforms, and abstracts all the C interfacing. We will be releasing it in a day or two.

Hi,

We have released a new package, please refer to the following:

https://docs.cryptlex.com/node-locked-licenses/using-lexactivator/using-lexactivator-with-go

Regards,
Adnan

Thank you for the fix. We will get back to you if we are facing any further issues.