0

I have a debug dll library which I try and export and array like so:

debuglib.h

#define MAX_DEBUG_EVENT_COUNT_PER_FRAME 65533
__declspec(dllexport) DebugEvent currentFrameDebugEventArray[MAX_DEBUG_EVENT_COUNT_PER_FRAME];

The library builds fine but then when I try to import that array into another dll that needs to use that array:

__declspec(dllimport) DebugEvent currentFrameDebugEventArray[MAX_DEBUG_EVENT_COUNT_PER_FRAME];

I get this error/warning message:

" warning C4273: 'currentFrameDebugEventArray': inconsistent dll linkage"

Am I using the dllexport/dllimport declarations incorrectly?

Jason
  • 2,198
  • 3
  • 23
  • 59
  • 2
    You probably `#include "debuglib.h"` into the file where `__declspec(dllimport) ...` line appears. So now the compiler sees two definitions of the same variable, one with `__declspec(export)` and another with `__declspec(dllimport)` – Igor Tandetnik Aug 15 '20 at 14:49
  • yes to both of you. The first comment is what made me realize why I needed that #if #else macro for a dll export. Thanks! – Jason Aug 15 '20 at 15:35

0 Answers0