Presently, there a number of global variables in libomptarget (devices, RTLs, tables, mutexes, etc.), that are not placed within a struct. This patch places them into a struct `PluginManager`. All of the functions that act on this data remain free. This may/will be succeeded by more patches that encapsulate the global libomptarget state.
I believe this patch is the first one of a series to refactor the libomptarget. I suggest to add your plan into the description. Otherwise, I didn't see any "encapsulation" from this patch. All members in the new class can still be accessed casually.
Thought I'd commented on this but can't see it. I like the change - one global instance holding all the state is much better than scattering the variables around.
It lends itself to a later change supporting N independent copies of the library, e.g. to facilitate testing.
I might have g