Implementing LDK Licensing in Matlab for both Windows and MAC OS

ISV can use Matlab functions – loadlibrary, calllib and unloadlibrary to implement LDK Licensing in application built using Matlab. Below is the process:

VENDOR_CODE = ‘Vendor_Code_String_from_HVC_File’;      

% Load Library in Mac OS

loadlibrary(‘hasp_darwin_XXXXX.dylib’, ‘hasp_api.h’)  

% Load Library in Windows

loadlibrary(‘hasp_windows_x64_XXXXX.dll’, ‘hasp_api.h’) 

% Create pointer to library

handler = libpointer(‘uint32Ptr’,0);

% Create libpointer to hold vendor code string

vcptr = libpointer(‘voidPtr’,[ uint8(VENDOR_CODE) 0]);  

% Call function from library

res = calllib(‘hasp_darwin_XXXXX’,’hasp_login’, 5, vcptr, handler);

if strcmp(‘HASP_STATUS_OK’,res)==0

 msgbox(‘Error: hasp_login’, ‘Sentinel LDK’, ‘error’);