The LMX_Checkin function will return the licenses for a single checked in feature or all checked in features.
Prototype
LMX_STATUS LMX_Checkin ( LMX_HANDLE LmxHandle, const char *szFeatureName, int nCount );
Parameters
LmxHandle
[in/out] LM-X handle.
szFeatureName
[in] Feature name. Use parameter LMX_ALL_FEATURES to check in all features.
nCount
[in] Number of licenses to check in.
Use parameter LMX_ALL_LICENSES to check in all licenses.
Return values
On success, this function returns the status code LMX_SUCCESS.
On failure, this function returns an error code in the format described in Return codes.
Remarks
If all licenses are returned to a license server, the licensing system will also ensure that the network connection is closed.
Using LMX_ALL_FEATURES with borrow early return is not supported. Instead, check in the features individually.
Example
The following example returns a license for feature "f2" to a license server.
#include <lmx.h> #include <stdio.h> LMX_HANDLE h; int main() { exit_on_error(LMX_Init(&h)); exit_on_error(LMX_Checkin(h, "f2", 1)); return 0; }
The example below shows initializing LM-X and an attempt to check out a license, after which it displays information about the license including the time remaining to expiration and it tries to check in the license.
#include <lmx.h> #include <stdio.h> LMX_HANDLE h; int main() { exit_on_error(LMX_Init(&h)); printf("LM-X client handle successfully initialized: %p\n",h); exit_on_error(LMX_Checkout(h, "f2", 1, 0, 1)); printf("Get a license.\n"); LMX_FEATURE_INFO FI; exit_on_error(LMX_GetFeatureInfo(h, "f2", &FI)); printf("FeatureName : %s\n", FI.szFeatureName); printf("VendorName : %s\n", FI.szVendorName); int nTimeLeft; nTimeLeft = LMX_GetExpireTime(h, "f2"); if (nTimeLeft == -2) printf("This feature does not expire\n"); else if (nTimeLeft == -1) printf("This feature is expired\n"); else printf("Hours left for this feature: %d\n", nTimeLeft); exit_on_error(LMX_Checkin(h, "f2", 1)); printf("License returned.\n"); LMX_Free(h); return 0; }