X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglwrap.c;h=68351143d31aca0567dca79c1d7051a885ced85c;hb=27a82684df128955f6c4e1467935be14ff9bb816;hp=0a22c3c1ce4b6677c0bb66cdb10d559294fbe160;hpb=6475e8951e1901b247f5d1d1dd9fcfc1e77e163a;p=gldbg.git diff --git a/source/glwrap.c b/source/glwrap.c index 0a22c3c..6835114 100644 --- a/source/glwrap.c +++ b/source/glwrap.c @@ -13,6 +13,7 @@ Distributed under the GPL #include #include #include +#include "arraysize.h" #include "functions.h" static inline void *glsym(const char *sym) @@ -20,10 +21,13 @@ static inline void *glsym(const char *sym) static void *libgl = NULL; if(!libgl) { - libgl = dlopen("libGL.so", RTLD_NOW); + const char *libgl_name = getenv("GLWRAP_LIBGL"); + if(!libgl_name) + libgl_name = "libGL.so"; + libgl = dlopen(libgl_name, RTLD_NOW); if(!libgl) { - fprintf(stderr, "Could not open libGL: %s\n", dlerror()); + fprintf(stderr, "Could not open %s: %s\n", libgl_name, dlerror()); abort(); } } @@ -75,12 +79,7 @@ static inline void write_long(long v) write_bytes((char *)&v, sizeof(long)); } -static inline void write_ulong(unsigned long v) -{ - write_bytes((char *)&v, sizeof(unsigned long)); -} - -static inline void write_longlong(long long v) +static inline void write_long_long(long long v) { write_bytes((char *)&v, sizeof(long long)); } @@ -116,11 +115,20 @@ static inline void write_data(const void *data, unsigned size) write_int(0); } -static inline void write_string(const unsigned char *s) +static inline void write_string(const char *s) { write_data(s, strlen(s)+1); } +static inline void write_string_array(const char **sa, unsigned size) +{ + unsigned i; + size /= sizeof(const char *); + write_int(size); + for(i=0; i