launchdarkly / cpp-sdks

C++ Client/Server SDKs
Other
5 stars 2 forks source link

Can't use C++ Client SDK functions with the prebuilt artifacts for v3.3.3 #367

Closed morrism05 closed 7 months ago

morrism05 commented 7 months ago

Describe the bug I've downloaded the prebuilt artifacts for the windows-msvc-x64-dynamic.zip launchdarkly-cpp-client v3.3.3 from your releases page here. I am able to use the prebuilt lib and dll to build and run the example hello-c-client, but I get linker errors when I try to use it with the example hello-cpp-client. I believe the prebuilt lib and/or dll is missing the C++ interfaces.

To reproduce Steps to reproduce the behavior:

Note that when I then tried to compile the C example hello-c-client instead with my LD credentials, I could successfully compile, link and run the example code.

Furthermore, when I use the Visual Studio 2022 command prompt to run "dumpbin /symbols launchdarkly-cpp-client.dll", I only see names like LDArrayBuilder_Add and LDClientSDK_New which appear to be the C interfaces.

Expected behavior I expect the prebuilt artifacts for the windows-msvc-x64-dynamic.zip to support building and linking against the C++ client SDK classes and functions.

SDK version 3.3.3

Language version, developer tools C++17 on Visual Studio 2022 17.8.5

OS/platform Windows 10

dumpbin_outputs.txt

cwaldren-ld commented 7 months ago

Hi @morrism05 , thanks for bringing up this issue (and all the detail!). If I understand correctly, you're trying to dynamically link against the C++ Client SDK.

From the README:

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.

This is because we don't want to (can't) promise a stable ABI for our shared objects. That's why it works fine with the C interface; we hide all other symbols.

I'm sorry this was probably a time sink for you, it's probably buried too deeply in the README.

In any case, the solution is to link statically. Would that be acceptable for you?

morrism05 commented 7 months ago

@cwaldren-ld thanks for the prompt reply! Yes, we are trying to dynamically link against the C++ Client SDK.

(In fact, we dynamically link against LaunchDarkly's 2.0.3 C++ SDK today. But our security scans say v2.0.3 using a version of curl with a security vulnerability, so we need to update.)

We might be able to use the C interface instead, but we are concerned about the Boost 1.81 requirement. Is the Boost requirement a build-time only requirement or is it a runtime requirement? Our application does not use Boost at runtime.

cwaldren-ld commented 7 months ago

In fact, we dynamically link against LaunchDarkly's 2.0.3 C++ SDK today.

I can't recommend continuing to use the 2.0.3 C SDK since it's deprecated - but if you were forced to, you could build it from source with a more recent version of CURL than our release process used at the time.

Is the Boost requirement a build-time only requirement or is it a runtime requirement? Our application does not use Boost at runtime.

It's a build requirement only:

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.

morrism05 commented 7 months ago

Thank you for the feedback! We'll probably just use the C SDK from our C++ app so that we can continue to use your prebuilt DLLs.