I'm trying to port an old library (that doesn't use namespaces as far as I can tell) to modern compilers. One of my targets can't tell the difference between System::TObject and ::TObject (without a namespace). System::TObject is native to the compiler.
I've tried a using directive, i.e. using ::TObject;
But that doesn't do it.
The obvious solution is to wrap all the original library in a namespace and then calling it by name- that should avoid the ambiguity. But is that the wisest solution? Is there any other solution? Adding a namespace would require changing a bunch of files and I don't know if it would have unwanted repercussions later.
You could make a wrapper for all the old functions and package them up into a DLL or static library.
You can do as Dib suggested, with a slight modification:
This allows you to #define the exclusion in only the files where you're getting conflicts, and use all the symbols as global symbols otherwise.
If you have the source to the library, maybe include a header file at the top of each source where that header file has only:
I have used the following in the past while encapsulating a third party header file containing classes colliding with the code:
This way, "Symbol" in the header was prefixed by ThirdParty and this was not colliding with my code.
Try this: