launchdarkly / c-client-sdk

LaunchDarkly Client-side SDK for C/C++
Other
8 stars 13 forks source link

Fix duplicate symbols linkage failure #61

Closed Ri0n closed 3 years ago

Ri0n commented 3 years ago

Declaring the callback variable without extern defined this variable in every compilation unit where this header was included. As result on the link stage same symbol appears in multiple object files and triggers link conflict/failure. Adding extern make compilation succeed

hroederld commented 3 years ago

Hi @Ri0n

Thanks for your PR! I am curious what method you used to compile the SDK? We test GCC / clang / MSVC in CI between different platforms and there does not appear to be any link failure, although this change does look correct to me.

The CI for OSX is failing with this PR but it is related to a change in CircleCI OSX support since our last release and looks unrelated to this PR.

hroederld commented 3 years ago

Hi @Ri0n

Looking at this again more in-depth: this variable does not even need to be defined in ldinternal.h. In the next release we will simply remove it.

Thanks!

Ri0n commented 3 years ago

Cool. it was Gentoo Linux with latest gcc and whatever linker comes by default

hroederld commented 3 years ago

@Ri0n

The release from this morning should remedy your issue: https://github.com/launchdarkly/c-client-sdk/releases/tag/2.1.2

Sorry for the delay!

Ri0n commented 3 years ago

Thanks @hroederld Unfortunately I've left the project where it was used. But I'll ping the guys who are still there :)

hroederld commented 3 years ago

I'm going to close this PR now. If you run into any other problems feel free to file an issue.