Matlab loadlibrary error for LexActivator

Hi,
I want to use Cryptlex Licensing with Matlab. I use Matlab 2021a, Win10, VS 2017++ compiler. (I know it says use VS 2015 for compatibility, but I assume backward compat?!)

The error I get when I run
loadlibrary(sharedLibrary, headerFile, ‘addheader’, statusHeaderFile);

is the following:

Error using loadlibrary
Building LexActivator_thunk_pcwin64 failed.  Compiler output is:
cl -I"C:\Program Files\MATLAB\R2021a\extern\include" /Zp8  /W3  /nologo  -I"C:\**"
-I"C:\***\headers" "LexActivator_thunk_pcwin64.c" -LD -Fe"LexActivator_thunk_pcwin64.dll"
LexActivator_thunk_pcwin64.c
C:\***\headers\LexActivator.h(341): error C2143: syntax error: missing ')' before '='
C:\***\headers\LexActivator.h(341): error C2072: 'GetLicenseMeterAttribute': initialization of a function
C:\***\headers\LexActivator.h(341): error C2059: syntax error: ')'

It occurs because l.341 uses “Default values in parameters” which is a C++ feature, but loadlibrary requires C. Can you help me fix this issue?

Hi,

Just remove the default params from the header file in the concerned functions.

thanks, that’s what I did. but will it cause problems under some circumstances? I mean there must be a reason why a default parameter is passed…

It was just added for backward compatibility as the old signature didn’t have grossUses param. So, you don’t need to worry about this.

1 Like

Hi, I posted a question correspondig to this topic here, but found this proper one too late… just to not spam, I appreciate help on the matter.