Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Start a new project in your IDE. Base your code on the example in LM-X_installation_directory\examples\local\local.c.

  2. Include the LM-X library into your application (see License your first application for more information).

  3. Generate a node-locked license file using xmllicgen, located in LM-X_installation_directory\platform-specific_directory; for example, C:\LM-X\Win32_x86.

  4. Using the OPTIONS setting, specify the number of processor cores that the license will be limited to. For example, "CPU=1" limits the license to one processor core, "CPU = 2" limits the license to two processor cores, etc. (We are using the syntax "CPU=x," but you may use different syntax if desired.)

    An example XML template for a node-locked license looks like the following:
     

    Code Block
    languagehtml/xml
    <?xml version="1.0" encoding="utf-8"?>
    <LICENSEFILE>
    <FEATURE NAME="F1">
    <SETTING MAJOR_VERSION="1" />
    <SETTING MINOR_VERSION="0" />
    <SETTING END="2015-01-01" />
    <SETTING OPTIONS="CPU=1" />
    <CLIENT_HOSTID>
    <SETTING ETHERNET="D71D90A3763DD3BF" />
    </CLIENT_HOSTID>
    </FEATURE>
    </LICENSEFILE>


  5. To take the number of cores into account in your code (based on the local.c example), change the checkout parameter using LMX_Checkout:

    LMX_Checkout(LmxHandle, "F1", 1, 0, 1)

    For processor-based licensing that sets the count to the number of logical CPUs, change the checkout parameter to:

    LMX_Checkout(LmxHandle, "F1", 1, 0, LMX_LOGICAL_CPU_COUNT)

    For processor-based licensing that sets the count to the number of physical CPUs, change the checkout parameter to:

    LMX_Checkout(LmxHandle, "F1", 1, 0, LMX_PHYSICAL_CPU_COUNT)

  6. To access the license setting OPTIONS "CPU=1” use FI.szOptions, which is available after calling LMX_GetFeatureInfo(LmxHandle, "F1").

    Retrieve the integer from string FI.szOptions and compare it with FI.nUsedLicCount, which is the actual number of CPUs. If the comparison does not match your limitation, you can force the program to exit (remember to use LMX_Free(LmxHandle) upon exit to free allocated memory). Otherwise, license restrictions are fulfilled and you can continue.

  7. Compile and run your application to test that it works as expected.

Using CPU cores for floating licenses

To base floating licenses on CPU cores (example is for a Windows environment):

...