My suggestion is this: create a shared library that contains the Gambit runtime library and link each of your math function shared libraries with the Gambit runtime library. So when you load any of the math function libraries, the Gambit runtime library will automatically be loaded (and initialized).
I tried doing this, I have an empty scheme file that I use to make a library linked with the gambit runtime library, I use this library for the SCHEME_LIBRARY_LINKER define. Then I compiled a simple function to a .so file, dlopen it, I get an address for the function pointer with dlsym, but when I call the function I still get a segmentation fault.
If this is too abstract, let me know and I'll see if I can write some real code for this. What operating system are you using? How do you do your dlopen calls in C?
Marc
This is what I have so far: http://people.freedesktop.org/~geckosenator/dlopenscheme.tar.gz
I'm not quite sure where I went wrong.
Thanks, Sean