File::separatorString prob

Hi Jules, I’ve hit a most odd problem. I’m using the juce core in a service and I’m trying to create a directory (via File::createDirectory) but it crashes on me because
File::separatorString is NULL. Yep. NULL :shock: I have no linking problems, juce_win32_NativeCode.cpp is included in the build with JUCE_ONLY_BUILD_CORE_LIBRARY=1.
Any ideas ?

Can only think of a couple of possibilities…

Are you using it in some code that’s called as part of a static object initialiser? That could mean that your code is running before the File::separatorString has been constructed.

Have you somehow managed to cast it to non-const and assign a new value to it?

Yes, the problem was that my static class tried to use File::separatorString, before its initialization. Mind you, it would be nice with a compiler feature to actually initialize static variables within libraries before code depending on them. And without using #pragma code_seg … :wink: