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:
...
Panel |
---|
# xmllicgen license.xml |
On Windows:
Panel |
---|
# xmllicgen.exe license.xml |
The resulting file will be license.lic. Xmllicgen will automatically replace your ".xml" extension with ".lic" and save the license next to your template.
...
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 function requires that the feature name, version and the count of the features be defined as shown below.
Code Block |
---|
if (LMX_Checkout(LmxHandle, "feature", 1, 0, 1) != LMX_SUCCESS) { printf("Unable to checkout\n"); LMX_Free(LmxHandle); return 1; } |
...
Code Block |
---|
#include <stdio.h> #include "lmx.h" int main() { LMX_HANDLE LmxHandle; if (LMX_Init(&LmxHandle) != LMX_SUCCESS) { printf("Unable to initialize!\n"); return 1; } // Look for licenses in current directory. LMX_SetOption(LmxHandle, LMX_OPT_LICENSE_PATH, "."); if (LMX_Checkout(LmxHandle, "feature", 1, 0, 1) != LMX_SUCCESS) { printf("Unable to checkout!\n"); LMX_Free(LmxHandle); return 1; } // Here you are safe to run your licensed features "printf("Here you can run_my_features( your features\n"); LMX_Checkin(LmxHandle, "feature", LMX_ALL_LICENSES); LMX_Free(LmxHandle); return 0; } |
...