The ideia is that by puting "using namespace std', I'm able to use iostream functions without any reference to the library thoose functions came from, but rather just calling them, and I want to do the same thing with my .dll;
No, you are still completely confused. A namespace is not a library. A namespace is a way to put a qualification on something in C++ to distinguish it from something not in the namespace. Some writers of libraries, (like the C++ Standard Library) choose to put the classes and other C++ entities in the library inside a namespace but that is completely optional. Qt is a library (actually, a whole collection of libraries), and by default it does not have a namespace. That's why you can declare a QWidget and don't have to declare a Qt::QWidget.
For example:
namespace NS
{
int foo;
}
int foo;
namespace NS
{
int foo;
}
int foo;
To copy to clipboard, switch view to plain text mode
There are two variable declarations in this code, each of them is unique. One of them is in the namespace "NS" and must be referred to as "NS::foo" and the other one is in the global namespace and is referred to as "::foo" (or, because C++ allows you to omit the namespace qualifier for things in the global namespace, as simply "foo").
But if you wrote code like this:
namespace NS
{
int foo;
}
int foo;
using namespace NS;
foo = 42;
namespace NS
{
int foo;
}
int foo;
using namespace NS;
foo = 42;
To copy to clipboard, switch view to plain text mode
The compiler would complain because there are two instances of variable "foo" and it can't tell which one you want to assign 42 to.
I don't want to have to create an object from that dll's class in order to use its functions, but just use them! ... My only doubt here is about not having to create an object from my dll in order to use its functions.
DLLs are not classes. They are libraries. Libraries might contain definitions of C++ classes, they might not. Most of them do, and you can't use a C++ class defined in a library without creating an instance of it in your own code, unless the library defines an instance of it as a global variable. (For example, the C++ Standard Library defines the global variables std::cout, std::cin, and std::cerr and you can simply use these in your own code).
Bookmarks