Skip to content

Commit

Permalink
Windows fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dgud committed Oct 12, 2010
1 parent d6851ea commit 560cd80
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions c_src/esdl_driver.c
Expand Up @@ -201,6 +201,7 @@ sdl_driver_debug_control(ErlDrvData handle, unsigned op,
gl_dispatch(sd, op, buf); gl_dispatch(sd, op, buf);
sdl_free_binaries(sd); sdl_free_binaries(sd);
fprintf(stderr, "\r\n"); fprintf(stderr, "\r\n");
return 0;
} }
} }


Expand Down
19 changes: 16 additions & 3 deletions c_src/esdl_gl.c
Expand Up @@ -8,7 +8,9 @@


#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#ifndef _WIN32
#include <dlfcn.h> #include <dlfcn.h>
#endif
#include "esdl.h" #include "esdl.h"


int esdl_gl_initiated = 0; int esdl_gl_initiated = 0;
Expand All @@ -20,14 +22,25 @@ ESDL_GL_DISPATCH esdl_gl_dispatch;
typedef int (*ESDL_GL_INIT) (); typedef int (*ESDL_GL_INIT) ();


#ifdef _WIN32 #ifdef _WIN32
#define RTLD_LAZY 0
typedef HMODULE DL_LIB_P;

void * dlsym(HMODULE Lib, const char *func) { void * dlsym(HMODULE Lib, const char *func) {
funcp = (void *) GetProcAddress(Lib, func); void * funcp;
return funcp; funcp = (void *) GetProcAddress(Lib, func);
return funcp;
}

HMODULE dlopen(const char *DLL, int unused) {
return LoadLibrary(DLL);
} }

#else
typedef void * DL_LIB_P;
#endif #endif


void es_init_opengl(sdl_data *sd, int len, char *bp) { void es_init_opengl(sdl_data *sd, int len, char *bp) {
void * LIBhandle; DL_LIB_P LIBhandle;
ESDL_GL_INIT init_opengl; ESDL_GL_INIT init_opengl;


char *start; char *start;
Expand Down

0 comments on commit 560cd80

Please sign in to comment.