Issue with lexactivator function's parameter passing


#1

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


#2

Hi,

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

Regards,
Adnan


#3

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


#4

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


#5

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:


#6

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.


#7

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


#8

Thank you for the update


#9

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.


#10

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


#11

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