Windows DLL __declspec(dllimport) placement

I just downloaded Juce 1.52 and attempted to build a DLL using the Visual Studio 2008 build and got the a bunch of errors like this:

Looking into the code (and after expanding the JUCE_PUBLIC_API define) it was lines like this that were causing the problem

String& __declspec(dllexport) __stdcall operator<< (String& string1, char characterToAppend);

The problem only arose on global functions that returned a reference rather than a value. The VC compiler didn’t like the placement of __declspec(dllexport)
I changed it to

__declspec(dllexport) String& __stdcall operator<< (String& string1, char characterToAppend);

And things seemed to compile just fine. If I bring back in the Juce defines, the code went from:

String& JUCE_PUBLIC_FUNCTION operator<< (String& string1, char characterToAppend);

to:

JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, char characterToAppend);

This fixed the problem. FYI, all these changes only had to take place in the juce_String.h and juce_String.cpp files.

I’m guessing this is a Windows only issue since the __declspec() doesn’t show up on other platforms. I haven’t tested anything with GCC. Not sure if attribute ((visibility(“default”))) will cause the same problem.

Perhaps a fix in the next release?
Cheers,

Thanks. That’s kind of strange, I’m sure it used to work ok… Anyway, I’ll take a look and see what I can do, cheers!