SDK Function Reference
The function library exports a standard C linkage interface. This ensures maximum compatibility, allowing you to load the dynamic library into C, C++, C#, Go, Rust, Python, Excel VBA, or any language with a Foreign Function Interface (FFI).
JSON Calculation Interface
These functions process string inputs containing JSON payloads (identical to our REST API requests) and return JSON responses as a dynamically allocated C-string.
sscmfi_calculate
extern char* sscmfi_calculate(char* jsonPayload);
- jsonPayload: A null-terminated UTF-8 string containing the full calculation JSON payload (including security type, given values, call schedule, etc.).
- Returns: A null-terminated JSON response string. Note: The caller must free this string using
sscmfi_free_string.
sscmfi_calculate_periodic / _discount / _iam / _stepped / _multistep / _pik
extern char* sscmfi_calculate_periodic(char* jsonPayload); extern char* sscmfi_calculate_discount(char* jsonPayload); extern char* sscmfi_calculate_iam(char* jsonPayload); extern char* sscmfi_calculate_stepped(char* jsonPayload); extern char* sscmfi_calculate_multistep(char* jsonPayload); extern char* sscmfi_calculate_pik(char* jsonPayload);
- Specific calculation entry points targeting dedicated bond math categories. They expect the matching JSON parameters for their category, bypassing the overhead of type-routing checks.
- Returns: A null-terminated JSON response string. Must be freed using
sscmfi_free_string.
FlatBuffers Binary Interface
For performance-critical applications, FlatBuffers allows you to pass pre-serialized binary buffers directly to the core engine. This avoids JSON encoding/parsing overhead.
sscmfi_calculate_[X]_binary
extern void* sscmfi_calculate_binary(void* bufPtr, int size, int* outSize); extern void* sscmfi_calculate_periodic_binary(void* bufPtr, int size, int* outSize); extern void* sscmfi_calculate_discount_binary(void* bufPtr, int size, int* outSize); extern void* sscmfi_calculate_iam_binary(void* bufPtr, int size, int* outSize); extern void* sscmfi_calculate_stepped_binary(void* bufPtr, int size, int* outSize); extern void* sscmfi_calculate_multistep_binary(void* bufPtr, int size, int* outSize); extern void* sscmfi_calculate_pik_binary(void* bufPtr, int size, int* outSize); extern void* sscmfi_calculate_part_pik_binary(void* bufPtr, int size, int* outSize);
- bufPtr: Pointer to the FlatBuffers input binary byte array.
- size: Length of the input buffer in bytes.
- outSize: A pointer to an integer where the engine will write the size of the returned response buffer.
- Returns: A pointer to the output FlatBuffers binary byte array. The caller must deallocate this memory using
sscmfi_free_binary.
Memory Management
Because the core library manages its own memory heap, pointers returned to client languages (C, C++, Go, Python, etc.) must be freed back to the library to prevent memory leaks.
sscmfi_free_string
extern void sscmfi_free_string(char* ptr);
- ptr: The JSON C-string pointer returned by any of the JSON calculation functions.
sscmfi_free_binary
extern void sscmfi_free_binary(void* ptr);
- ptr: The binary array pointer returned by any of the FlatBuffers calculation functions.
Licensing & Initialization
The SDK must be successfully initialized before any calculations can be executed.
sscmfi_init
extern char* sscmfi_init(char* apiKey);
- apiKey: Your company's licensing API key.
- Functionality: Validates the key with the online authentication servers and caches licensing information locally. If licensing servers are unreachable, it verifies the local licensing information to permit offline fallback calculations.
- Returns: A null-terminated initialization status message. If initialization fails (e.g., key is expired or invalid, and no local licensing verification data exists), it returns a detailed error string, such as:
"licensing initialization failed: all licensing servers unreachable and no valid local verification data was found. The function library must have internet access to validate the license on initial startup."
