I am trying to build a Dynamic DLL in VC++ 2008, now in a .h file, I declare the following
#ifndef PREFILTER_LIBRARY_H
#define PREFILTER_LIBRARY_H
#ifdef PREFILTER_EXPORTS
# define PREFILTER_API __declspec(dllexport)
#else
# define PREFILTER_API __declspec(dllimport)
#endif
#endif
While in the PreFilter.h file I am writing
class PREFILTER_API PreFilter
{
...
};
The problem is I keep getting:
warning C4273: 'PreFilter::Apply' : inconsistent dll linkage
I see that the dllexport part of the above macros is not highlighted and is commented which should have been the other way around, plus I have another .h file that contains Apply() method.
Can’t figure out what I am doing wrong here. I am trying to export the functions of PreFilter.h
Add PREFILTER_EXPORTS to the list of preprocessor constants in Dll project settings: Project – Properties – Configuration Properties – C++ – Preprocessor – Preprocessor definitions.
When this file is used in Dll project, PREFILTER_EXPORTS is defined in the project, and PREFILTER_API is expanded as __declspec(dllexport). In any other project, where PREFILTER_EXPORTS is not defined, PREFILTER_API is expanded as __declspec(dllimport).