SK_ApiContextInitialize Function

Initializes a new API Context, which may be used to open and manipulate a license file.

Remarks

Important Note

The API context returned in the context parameter must be freed from memory! The SK_ApiContextDispose function is recommended for this purpose.

Important Note

If your application is multi-threaded, it is important that the first call to this function occurs on your application's main thread and specifies the SK_FLAGS_APICONTEXTINITIALIZE_MAINTHREAD flag. Failing to do so can cause global data for dependencies to be initialized on other threads, which may cause erroneous behavior and memory leaks. Calling this function with the SK_FLAGS_APICONTEXTINITIALIZE_MAINTHREAD flag more than once is not supported, and may also cause erroneous behavior.

Syntax

C/C++
SK_ResultCode SK_ApiContextInitialize(int flags, SK_BOOL licenseWritable, int prodId, int prodOptionId, const char *prodVersion, const char *envelope, SK_ApiContext *context);
Visual Basic
Declare Function SK_ApiContextInitialize(ByVal flags As Long, ByVal licenseWritable As Long, ByVal prodId As Long, ByVal prodOptionId As Long, ByVal prodVersion As String, ByVal envelope As String, ByRef context As Long) As Long

Arguments

flags
Any flags specific to this function-call.
licenseWritable
Specifies whether or not the API context will be used with writable license files.
prodId
The Product ID in SOLO Server from which licenses are created.
prodOptionId
(Optional - set to zero (0) to ignore.) The Product Option ID in SOLO Server from which licenses are created.
prodVersion
(Optional - set to an empty string or NULL (0) to ignore.) The Product Version number (must be formatted like X.X.X.X, where X is 5 digits or less).
envelope
The encryption key envelope from SOLO Server.
context
Reference/pointer to the new context which is initialized by this function. The context must be initialized to NULL (0) prior to calling this function.

Returns

All possible return values are included in the SK_ResultCode enumeration. Return codes to expect include:

Result Code Description
SK_ResultCode.SK_ERROR_NONE No error.
SK_ResultCode.SK_ERROR_INVALID_ARGUMENTS Some or all of the arguments are invalid.
SK_ResultCode.SK_ERROR_MEMORY_ALLOCATION Memory could not be allocated.