Now that you have defined a license policy, you need a license template to integrate LM-X with your application.
License file
To generate an XML license template:
...
The resulting file will be licens.lic. Xmllicgen will automatically replace your ".xml" extension with ".lic" and save the license next to your template.
Header file
First of all, you must include the required header, lmx.h, located in the include directory of your SDK.
...
Panel |
---|
cl /I “C:\Program Files\X-Formation\LM-X SDK v4.6.1 win64_x64\include\” |
Commonly used functions
In the following examples we will present five commonly used LM-X API functions.
LMX_Init
The LMX_Init function initializes the protection system. This function creates a handle needed to use other LM- X API functions. It returns LMX_STATUS variable that indicates initialization status.
...
Code Block |
---|
LMX_SetOption(LmxHandle, LMX_OPT_LICENSE_PATH, "."); |
LMX_Checkout
The LMX_Checkout function is one of the most important LMX API functions, because it checks out one or more licenses for a specific feature. This type of function requires that the feature name, version and the count of the features be defined as shown below.
...
- Initialize the LM-X client library.
- Set the license path.
- Do the checkout.
- If the checkout succeeds, run your licensed feature.
- After work, do the checkin. what does it mean??? "After work"?
- Free your LM-X client library.
Compilation
Let's assume you saved your program source code as an example.c and installed your LM-X SDK in the default directory.
...
Code Block |
---|
cl /WX /MT /c /O2 -D_CRT_SECURE_NO_DEPRECATE /I "C:\Program Files\X-Formation\LM-X SDK v4.6.1 win64_x64\include\" example.c link /WX /opt:noref example.obj "C:\Program Files\X-Formation\LM-X SDK v4.6.1 win64_x64\win64_x64\liblmxclient_mt.lib" |
Running your application
Now you should have the following files in your current directory:
...