Reputation: 7959
I'm using a third party C++ lib in one of my current projects. Their lib does not define a custom namespace, though. So, all of their functions are just out there. This isn't a big deal, but ideally they'd have used a namespace.
Is it possible to #include
their header files under a custom pseudo namespace of some kind? This way, all of their functions could be included in a namespace.
Upvotes: 1
Views: 335
Reputation: 319
As you say, if they were in a namespace it would be better. However it is not much of a concern.
Alternatively if you are able to have the .dll instead of .lib, you can bind it dynamically, use it, and let it go. This way you wont have floating functions for the whole run-time.
Upvotes: 0
Reputation: 133
You cannot do that as long as this will change the name of the function( for C++ ). Linker will append the name of the namespace to the function, so the linkage will be failed due to the absence of the functions.
For instace for the following code
namespace MyName
{
class MyNestedOne
{
public:
void doNothing( );
};
};
the function doNothing will have following name doNothing@MyNestedOne@MyName@@
Upvotes: 1