Skip to content

Multiple versions causing conflict #3588

Closed
@nathanieltagg

Description

@nathanieltagg

Description

I'm using a 3rd party library that uses nlohmann/json under the hood. I am also using it in my code.

I have found that unless these two versions are exactly the same, there are side effects that cause the code not to function in the 3rd party library. (The failure happens with 3.9.2 in the 3rd party library and 3.10.5 in mine.) The exact failure I can't pinpoint, because it happens deep in code I'm not famililar with, but it causes no build-time error or crash, but DOES cause incorrect behavior that appears to be null JSON objects.

Keeping my version matched to the library gives me temporary respite, but is a pain to maintain, and becomes unsolvable if it happpens with yet another library.

The problem is clearly a collision in object code resolution. Could we have it customizable to change from nlohmann to MYNAMESPACE::nlhomann? Wrapping the header file in a namespace doesn't work for a variety of reasons. I CAN do a very cheap hack by doing
#define nlhomann my_nlhomann
but I suspect that might not be very sustainable.

Or perhaps there is another solution that I haven't found online?

Reproduction steps

The 3rd party library in question is depthai-core, in a dependency.

Expected vs. actual results

The exact throw is "cannot use at() with null", but this is due to a previous problem.

Minimal code example

No response

Error messages

No response

Compiler and operating system

Linux gcc

Library version

3.9.2, 3.10.5

Validation

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions