Sha256: 044227292d40515ff23accbdf36f8baea3b360fc6219cac74d8a4ed88dcb4006

Contents?: true

Size: 811 Bytes

Versions: 2

Compression:

Stored size: 811 Bytes

Contents

/*
 * Code stolen from GLEW, to do what GLEW should be doing.
 */
#include "say.h"

#ifdef SAY_WIN
void *say_get_proc(const char *name) {
  return (void*)wglGetProcAddress((LPCSTR)name);
}
#else
# ifdef SAY_OSX

#include <dlfcn.h>
void *say_get_proc(const char *name) {
  static void *handle = NULL;
  if (!handle) {
    handle = dlopen("/System/Library/Frameworks/OpenGL.framework/"
                    "Versions/Current/OpenGL", RTLD_LAZY);
  }

  /* prepend a '_' for the Unix C symbol mangling convention */
  char *symbol_name = malloc(strlen(name) + 2);
  strcpy(symbol_name + 1, name);
  symbol_name[0] = '_';

  void *ptr = dlsym(handle, symbol_name);
  free(symbol_name);
  return ptr;
}
# else
void *say_get_proc(const char *name) {
  return (void*)glXGetProcAddress((GLubyte*)name);
}
# endif
#endif

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ray-0.2.1 ext/say_get_proc.c
ray-0.2.0 ext/say_get_proc.c