Skip to content

Latest commit

 

History

History
142 lines (102 loc) · 6.88 KB

README.md

File metadata and controls

142 lines (102 loc) · 6.88 KB

LaunchDarkly Client-Side SDK for C/C++

Actions Status Documentation

The LaunchDarkly Client-Side SDK for C/C++ is designed primarily for use in desktop and embedded systems applications. It follows the client-side LaunchDarkly model for single-user contexts (much like our mobile or JavaScript SDKs). It is not intended for use in multi-user systems such as web servers and applications.

For using LaunchDarkly in server-side C/C++ applications, refer to our Server-Side C/C++ SDK.

LaunchDarkly overview

LaunchDarkly is a feature management platform that serves trillions of feature flags daily to help teams build better software, faster. Get started using LaunchDarkly today!

Twitter Follow

Compatibility

This version of the LaunchDarkly SDK is compatible with POSIX environments (Linux, OS X, BSD) and Windows.

Getting started

Download a release archive from the Github releases for use in your project.

Refer to the SDK documentation for complete instructions on installing and using the SDK.

Incorporating the SDK

The SDK can be used via a C++ or C interface and can be incorporated via a static library or shared object. The static library and shared object each have their own use cases and limitations.

The static library supports both the C++ and C interface. When using the static library, you should ensure that it is compiled using a compatible configuration and toolchain. For instance, when using MSVC, it needs to be using the same runtime library.

Using the static library also requires that you have OpenSSL and Boost available at the time of compilation for your project.

The C++ API does not have a stable ABI, so if this is important to you, consider using the shared object with the C API.

Example of basic compilation using the C++ API with a static library using gcc:

g++ -I path_to_the_sdk_install/include -O3 -std=c++17 -Llib -fPIE -g main.cpp path_to_the_sdk_install/lib/liblaunchdarkly-cpp-client.a -lpthread -lstdc++ -lcrypto -lssl -lboost_json -lboost_url

Example of basic compilation using the C API with a static library using msvc:

cl /I include /Fe: hello.exe main.cpp /link lib/launchdarkly-cpp-client.lib

The shared library (so, DLL, dylib), only supports the C interface. The shared object does not require you to have Boost or OpenSSL available when linking the shared object to your project.

Example of basic compilation using the C API with a shared library using gcc:

gcc -I $(pwd)/include -Llib -fPIE -g main.c liblaunchdarkly-cpp-client.so

The examples here are to help with getting started, but generally speaking the SDK should be incorporated using your build system (CMake for instance).

CMake Usage

First, add the SDK to your project:

add_subdirectory(path-to-sdk-repo)

Currently find_package is not yet supported.

This will expose the launchdarkly::client target. Next, link the target to your executable or library:

target_link_libraries(my-target PRIVATE launchdarkly::client)

Learn more

Read our documentation for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the complete reference guide for this SDK.

Testing

We run integration tests for all our SDKs using a centralized test harness. This approach gives us the ability to test for consistency across SDKs, as well as test networking behavior in a long-running application. These tests cover each method in the SDK, and verify that event sending, flag evaluation, stream reconnection, and other aspects of the SDK all behave correctly.

Contributing

We encourage pull requests and other contributions from the community. Read our contributing guidelines for instructions on how to contribute to this SDK.

Verifying SDK build provenance with the SLSA framework

LaunchDarkly uses the SLSA framework (Supply-chain Levels for Software Artifacts) to help developers make their supply chain more secure by ensuring the authenticity and build integrity of our published SDK packages. To learn more, see the provenance guide.

About LaunchDarkly

  • LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can:
    • Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases.
    • Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
    • Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
    • Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline.
  • LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Read our documentation for a complete list.
  • Explore LaunchDarkly