Reputation: 75
I got this massive project with many classes with definitions in dll files. I need to extract a part of this project and create a new project from that part. I have managed to find some dll files by using the Code Map in Visual Studio but some classes are not shown up there.
# ifdef FCBase
# define BaseExport __declspec(dllexport)
# else
# define BaseExport __declspec(dllimport)
# endif
class BaseExport Handled
{.
.
};
What is specifying which dll files are linked to what?
Upvotes: 1
Views: 373
Reputation: 4153
Directive __declspec(dllexport)
indicates that anything declared with this directive will be exported from a DLL to be used in some other application that links to that DLL. So when writing header files for code that will be compiled into a DLL, functions declarations and class definitions are decorated with this directive. On the other hand, code that will use these functions and classes will need to declare them with __declspec(dllimport)
, to let the linker know they will be imported from a DLL.
Both directives are often replaced by a single macro, which resolves to appropriate value depending on project settings. This way, you can include the same header in DLL implementation files and implementation files for some other application that will use this DLL. For instance, in your case the project for DLL will have FCBase
defined so BaseExport
will resolve to __declspec(dllexport)
during preprocessing step. That indicates that this project is for implementation of DLL. Project that does not have FCBase
defined, which means that the project is importing functions an classes from DLL.
Upvotes: 1