Integrate Licensecc in your application

This guide shows how to integrate licensecc into a C++ application, expanding the content of quickstart.

Working examples are provided in the examples project.

Call Licensecc from your code

The public API is declared in include/licensecc/licensecc.h. The two main entry points are:

  • identify_pc() — compute a hardware identifier for the current machine.

  • acquire_license() — locate, parse, and verify a license file.

A typical usage pattern:

#include <licensecc/licensecc.h>

LicenseInfo licenseInfo;
LCC_EVENT_TYPE result = acquire_license(nullptr, nullptr, &licenseInfo);

if (result == LICENSE_OK) {
    // License is valid -- proceed
} else if (result == LICENSE_FILE_NOT_FOUND) {
    // No license found -- print hardware identifier so the user can request one
    char pc_identifier[LCC_API_PC_IDENTIFIER_SIZE + 1];
    size_t pc_id_sz = sizeof(pc_identifier);
    if (identify_pc(STRATEGY_DEFAULT, pc_identifier, &pc_id_sz, nullptr)) {
        std::cout << "Hardware ID: " << pc_identifier << std::endl;
    }
    exit(1);
}

For a complete working example with error handling and event-type mapping, see the basic features examples on GitHub.

See the public api reference for full documentation of all types and functions.