print '#ifndef _GNU_SOURCE' print '#define _GNU_SOURCE // for dladdr' print '#endif' print '#include <dlfcn.h>' print print '#include "trace_writer.hpp"' print print '// To validate our prototypes' print '#define GL_GLEXT_PROTOTYPES' print print '#include "glproc.hpp"' print '#include "glsize.hpp"' print api = API() api.add_api(cglapi) api.add_api(glapi) tracer = CglTracer() tracer.trace_api(api) print r''' /* * Handle to the true libGL.so */ static void *libgl_handle = NULL; /* * Lookup a libGL symbol
print print '#ifndef _GNU_SOURCE' print '#define _GNU_SOURCE // for dladdr' print '#endif' print '#include <dlfcn.h>' print print '#include "trace_write.hpp"' print print '#include "glproc.hpp"' print '#include "glsize.hpp"' print print 'static __GLXextFuncPtr __unwrap_proc_addr(const GLubyte * procName, __GLXextFuncPtr procPtr);' print api = API() api.add_api(glxapi) api.add_api(glapi) tracer = GlxTracer() tracer.trace_api(api) print 'static __GLXextFuncPtr __unwrap_proc_addr(const GLubyte * procName, __GLXextFuncPtr procPtr) {' print ' if (!procPtr) {' print ' return procPtr;' print ' }' for f in api.functions: ptype = function_pointer_type(f) pvalue = function_pointer_value(f) print ' if (!strcmp("%s", (const char *)procName)) {' % f.name print ' %s = (%s)procPtr;' % (pvalue, ptype) print ' return (__GLXextFuncPtr)&%s;' % (f.name, ) print ' }'
print print '#ifndef _GNU_SOURCE' print '#define _GNU_SOURCE // for dladdr' print '#endif' print '#include <dlfcn.h>' print print '#include "trace_write.hpp"' print print '#include "glproc.hpp"' print '#include "glsize.hpp"' print print 'static __GLXextFuncPtr __unwrap_proc_addr(const GLubyte * procName, __GLXextFuncPtr procPtr);' print api = API() api.add_api(glxapi) api.add_api(glapi) tracer = GlxTracer() tracer.trace_api(api) print 'static __GLXextFuncPtr __unwrap_proc_addr(const GLubyte * procName, __GLXextFuncPtr procPtr) {' print ' if (!procPtr) {' print ' return procPtr;' print ' }' for f in api.functions: ptype = function_pointer_type(f) pvalue = function_pointer_value(f) print ' if (!strcmp("%s", (const char *)procName)) {' % f.name print ' %s = (%s)procPtr;' % (pvalue, ptype) print ' return (__GLXextFuncPtr)&%s;' % (f.name,) print ' }'
char szDll[MAX_PATH] = {0}; if (!GetSystemDirectoryA(szDll, MAX_PATH)) { return NULL; } strcat(szDll, "\\\\opengl32.dll"); g_hDll = LoadLibraryA(szDll); if (!g_hDll) { return NULL; } } return GetProcAddress(g_hDll, lpProcName); } ''' print '// To validate our prototypes' print '#define GL_GLEXT_PROTOTYPES' print '#define WGL_GLXEXT_PROTOTYPES' print print '#include "glproc.hpp"' print '#include "glsize.hpp"' print api = API() api.add_api(glapi) api.add_api(wglapi) tracer = WglTracer() tracer.trace_api(api)
char szDll[MAX_PATH] = {0}; if (!GetSystemDirectoryA(szDll, MAX_PATH)) { return NULL; } strcat(szDll, "\\\\opengl32.dll"); g_hDll = LoadLibraryA(szDll); if (!g_hDll) { return NULL; } } return GetProcAddress(g_hDll, lpProcName); } ''' print '#include "glproc.hpp"' print '#include "glsize.hpp"' print print 'extern "C" {' print api = API() api.add_api(glapi) api.add_api(wglapi) tracer = WglTracer() tracer.trace_api(api) print print '} /* extern "C" */'
print "#ifndef _GNU_SOURCE" print "#define _GNU_SOURCE // for dladdr" print "#endif" print "#include <dlfcn.h>" print print '#include "trace_writer.hpp"' print print "// To validate our prototypes" print "#define GL_GLEXT_PROTOTYPES" print print '#include "glproc.hpp"' print '#include "glsize.hpp"' print api = API() api.add_api(cglapi) api.add_api(glapi) tracer = CglTracer() tracer.trace_api(api) print r""" /* * Handle to the true libGL.so */ static void *libgl_handle = NULL; /* * Lookup a libGL symbol