Shared Library w/ internal AGL calls

Background:
I am creating a Carbon based shared library which will boil down to the most basic C interface possible. Starting with existing C++ code, I am generating two levels of shared libraries to wind up with this basic, basic C-compiled shared library. Thus, I am attempting to abstract away from everything non-C. This library uses OpenGL to render into an offscreen buffer, the results of which then are to be used for whatever. In this library exists AGL and OpenGL calls. The AGL calls are to set up the pixel format, the context and the offscreen world. The OpenGL calls are standard. During testing of the original C++ class, everything runs perfectly.

The problem:
Once I generate the shared library and load it back into an App for testing/using, as soon as the code hits the first internal AGL call the App terminates instantly. The first internal AGL call causes this crash. The call is:
aglChoosePixelFormat(NULL, 0, attrib);

‘attrib’ being defined as:
GLint attrib[] = { AGL_RGBA, AGL_OFFSCREEN, AGL_NONE };

As I mentioned, when using the code as simply code (and not a compiled shared library) everything works fine. Does anyone know the cause of this behavior? This is the first time I have attempted something of this nature. Is the problem that I cannot make any such calls from within a shared library?

Any help would be very appreciated.

Thanks,
Josh

What is the crash? Somewhere in dyld?

You’ll need to link either the shared library or the app that uses it against AGL.framework, Carbon.framework, OpenGL.framework, etc.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.