Prevent mixing of almagamted and non-almagamted clde


#1

In some Files like “juce\extras\audio plugins\wrapper\juce_PluginHeaders.h” is a direct include of “…/…/…/juce_amalgamated.h”, but i prefer working with the original Juce-Project file.

There should be be a warning if somebody tries to mix amalgamated with non-amalgamated code

like this:

#if ! (defined (JUCE_REGULAR) || defined (JUCE_AMALAGATED))
#error You are trying to mix amalgamated with non-amalgamated code
#endif


#2

It’s ok to include the amalg headers in a non-amalg build. It’s only when you do the opposite that you’d get a problem in win32 because it starts trying to link to the static libs.


#3
  • As long as both refers to the same exact code and configuration (config.h).
    Else you get impossible-to-debug crash with the compiler seeing a class format, and you, reading “another” code, trying to figure out what that particular member go crazy.
    Also, you can get duplicate symbol on link, but it’s easy to spot with most compiler.

#4

jules, can you change the include behavior in juce\extras\audio plugins\wrapper\juce_PluginHeaders.h

Maybe just setting flag in JucePluginCharacteristics.h, if somebody prefers “juce.h” instead juce_amalgamated.h

Its because i use the static lib (for several reasons, its easier to debug, you can see whats going inside the libraries, this amalgamated files are too big, and my intellisense getting confused etc…)


#5

Not sure I understand - it shouldn’t make any difference whether you include juce.h or juce_amalgamated.h - the content’s the same, isn’t it?


#6

Personally I always include juce via a separate header, which simply includes either juce.h or juce_amalgamated.h based on a macro definition (in the same file). I just comment/uncomment the macro to switch, without having to change any other files.

Although, I’ve noticed the more recent amalgamated juce seems to handle debugging better (used to be I’d be dumped at some random position when hitting a juce assert, but not seen that for a while). I tend to just use the amalgamated version lately, but it’s nice to easily change.


#7

No, the options in the static lib are defined in juce_config.h.
juce.h includes juce_config.h, “juce_amalgamated.h” not

#include "juce_IncludeCharacteristics.h" #ifdef USE_JUCE_ALMAGATED #include "../../../juce_amalgamated.h" #else #include "../../../juce.h" #endif