Solaris 10 seg fault when using libdl to load libGL
I don't know if this is an appropriate forum for this question -- please point me in the right direction if you can.
I'm porting some GL code from linux to Solaris 10 and found that it was causing segmentation faults. I've reduced the code to a single file to highlight the problem (attached as libgldebug.cpp.txt). To compile, I've been using:
g++ -g -c -I /usr/X11/include/NVIDIA/ libgldebug.cpp
g++ -o libgldebug -lpthread -lX11 -lXext libgldebug.o
I'm using g++ version 3.4.5.
Briefly, the problem seems to arise from using multithreading (pthreads) in conjunction with lib DL (dynamic linking functions). I dynamically-programatically link libGL (grabbing the function "glxChooseVisual") and call it. If I make the call in one thread only, it succeeds, but for more than one thread it seg faults in libGL.so. This same code works *fine* in Linux. I'm very confused...