I'm assuming you are seeing this behavious because you are doing inline initialization of global variables without an explicit function call. e.g. globals.cpp:
// top of source file
#include "myincludes.h"
CSomeClass someObject(432);
int global_x = 42;
int global_y = InitY();
The constructor and destructor order of global objects and global variable initialization order is mostly non-deterministic. (I would surmise, without consulting the standard reference pages, that variables in a source file get initialized from top declaration to bottom, but the order of "which source file comes first" is not defined.)
The best solution is to not have any global objects (where the constructor gets run before any functions in the library) or have a dependency on global variable initialization order.
Better to have a function that explicitly initializes your library. Perhaps you require the app to call this function one on startup or the exported functions of your library call it after detecting the initialization has not occurred. Initialize your globals then.
On my team, code that runs before "main" (or "DllMain") is strictly disallowed. In other words, no global objects. No functions to init globals.