title: Checking type of variables in dynamically loaded shared libraries in C/C++
body: <p>I'm working on a test environment of a C library. The library extensively use global variables, what I want to check in the test codes. Unfortunately I have to load the library dynamically (using libdl) to be able to reset the function static variables. This way I have to load every global using dlsym() and I have to cast them one by one manually to the correct type. Is there any way to automatize that and get the type info of the variables somehow?
  As far as I see libdl has no such feature. I wondered that I might be able to link to gdb, using it to access to shared library globals, but I didn't managed to find any clue about that possibility either. </p>