1

We're working on an SDK that gets published to many game developers. We're using LibTomCrypt for some cryptography stuff. We've gotten some reports of it conflicting with some users who also use LibTomCrypt, and have a different version.

I'm wondering if I can hide this thing somehow so that external client code can't see that we have that library in there.

LibTomCrypt is a C library and our project is C++, which is built and used as a static library.

We build using MSVC for x64, Win 32 and XBoxONE, and we use Sony's Clang for PS4.

Almo
  • 15,538
  • 13
  • 67
  • 95
  • Which tool stack are you using? – Mark Ransom Jul 17 '17 at 18:39
  • 2
    Is your stuff published to be linked statically or dynamically? – user0042 Jul 17 '17 at 18:39
  • If LibTomCrypt is open source, you might be able to create a version that "wraps it in a namespace". But that would be a nontrivial amount of work, although a lot of it could be automated – Justin Jul 17 '17 at 18:43
  • @Justin That's an option. The files say "The library is free for all purposes without any express guarantee it works." – Almo Jul 17 '17 at 18:46
  • 1
    Absent modifying the library, this would only work on systems that have a dynamic linker with two-level name spacing, otherwise both your library and the game will have to be linked agains the same LibTomCrypt. Windows has that, Apple platforms have some kind of implementation of it, and AFAIK Linux and derivatives don't. – zneak Jul 17 '17 at 18:47
  • 4
    (Using LibTomCrypt as a static library would solve your problems on all platform.) – zneak Jul 17 '17 at 18:49
  • 1
    @zneak not so, if two different versions of the library are required. – Mark Ransom Jul 17 '17 at 19:20
  • @MarkRansom, as long as the static LibTomCrypt isn't re-exported, it won't conflict with a second copy, static or dynamic (at the possible cost of duplicated code). – zneak Jul 17 '17 at 19:29
  • @zneak in my experience *all* functions are exported from a static library. And I'm not even sure it's possible to link a static library into another static library. – Mark Ransom Jul 17 '17 at 19:37
  • @MarkRansom, the static library and platform mentions appeared after I commented (or I didn't refresh, or something like that). I still think that it should be possible, though it's [easier](https://stackoverflow.com/questions/2222162/how-to-apply-gcc-fvisibility-option-to-symbols-in-static-libraries) for dynamic libraries (at least on some systems). – zneak Jul 17 '17 at 20:23

0 Answers0