Versions Compared

Key

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

...

Code Block
<?xml version="1.0" encoding="UTF-8"?>
<LICENSEFILE>
  <FEATURE NAME="feature">
    <SETTING MAJOR_VERSION="1"/>
    <SETTING MINOR_VERSION="0"/>
    <SETTING END="2018-01-01"/>
  </FEATURE>
</LICENSEFILE>

To Run xmlicgen to convert the above LM-X license template to a license file, run xmlicgen.

On Unix:

Panel

 #

xmllicgen

license.xml 

On Windows:

Panel

# xmllicgen.exe license.xml

...

Code Block
LMX_Free(LmxHandle);

Making it work

The following example illustrates a basic example of an complete, compiled example that includes source code necessary to license your application using LM-X licensed applicationLicense Manager.

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 your features\n");
 
  LMX_Checkin(LmxHandle, "feature", LMX_ALL_LICENSES);
  LMX_Free(LmxHandle);
  return 0;
}

...

To compile your first program run the following:

GCC:

Code Block
gcc
 -c -pthread -fPIC -Wall -Werror -fno-strict-aliasing -m64 -Wfatal-errors -Wno-unused-local-typedefs -Wno-vla -Wno-attributes -O2 -c -O2 -I/usr/lmx-sdk-4.6.1/include/ example.c 

gcc -static-libgcc -o example example.o /usr/lmx-sdk-4.6.1/linux_x64/liblmxclient.a -pthread -lrt -ldl

...

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:Your current directory should include the files listed in the table below.

FileDescription
license.xmlYour license template.
license.licReady to use license, generated with xmllicgen.
example.cYour first program source code.
example/example.exeYour program executable.

...