Update: wchar_t Not always native
After a fairly lengthy exchange of information and some additional information from the OP, the problem matters:
class __declspec(dllimport) MyException { public: MyException(unsigned int _line, const char *_file, const char *_function, MyExceptionType _type, const wchar_t* _message = 0,
Visual C ++ can be configured to treat wchar_t as a native type or not. Unless considered as a native type, unsigned short is the specified macro substitution for wchar_t . Linker complained that the above function was unsolvable, but what really caught my attention was at the tail of the undefined character:
,unsigned short const *,...)
Pay attention to unsigned short . This reminded me that the compiler used non-native wchar_t when compiling the EXE. I thought it was possible that the DLL might have been compiled with wchar_t configured as native, thereby introducing a different signature and thus not matching the reference time.
If you are surprised that this was a problem, imagine how surprised Rahkesh and I = P
Original answer
This class should be in the same general header with the preprocessor logic to determine the correct status of the import / export declaration. For instance:
Mydll.h
#ifndef MYDLL_H #define MYDLL_H
Then, in your DLL project that implements the exception (and only in this project), add MYDLL_EXPORTS to the list of preprocessors in your project configuration.
source share