what I've got here is pretty much a dumb and noobie question, but I just can`t find an answer on the web. When I want to create a DLL project (out of an existing c++ project), I read that I need to implement the following lines in the beginning of the .h files:
#ifdef _EXPORTING
#define CLASS_DECLSPEC __declspec(dllexport)
#else
#define CLASS_DECLSPEC __declspec(dllimport)
#endif
I looked at the example in the MSDN:
// MathFuncsDll.h
#ifdef MATHFUNCSDLL_EXPORTS
#define MATHFUNCSDLL_API __declspec(dllexport)
#else
#define MATHFUNCSDLL_API __declspec(dllimport)
#endif
Now I want to understand, do I need to change the "_EXPORTING" and the "CLASS_DECLSPEC" for every new class I make? For example if I'd create a class named "foo" within the same project as "MathFuncsDll.h" I'd need to put the following lines at the start of the .h file:
// FooDll.h
#ifdef FOO_EXPORTS
#define FOO_API __declspec(dllexport)
#else
#define FOO_API __declspec(dllimport)
#endif
Or is some line is the same in all .h files of the project?
And another thing, if I use a namespace
to reference the whole dll as one and extract the classes from it, do I need to put the using namespace *NAME*
in every .h file?