Browse Source

mcp2210: Port to Windows

Luke Dashjr 12 years ago
parent
commit
2afb5237dd
1 changed files with 13 additions and 1 deletions
  1. 13 1
      mcp2210.c

+ 13 - 1
mcp2210.c

@@ -9,7 +9,19 @@
 
 #include "config.h"
 
+#ifndef WIN32
 #include <dlfcn.h>
+typedef void *dlh_t;
+#else
+#include <winsock2.h>
+#include <windows.h>
+#define dlopen(lib, flags) LoadLibrary(lib)
+#define dlsym(h, sym)  ((void*)GetProcAddress(h, sym))
+#define dlerror()  "unknown"
+#define dlclose(h)  FreeLibrary(h)
+typedef HMODULE dlh_t;
+#endif
+
 #include <stdbool.h>
 #include <stdint.h>
 #include <stdio.h>
@@ -49,7 +61,7 @@ static
 bool hidapi_try_lib(const char * const dlname)
 {
 	struct hid_device_info *hid_enum;
-	void *dlh;
+	dlh_t dlh;
 	
 	dlh = dlopen(dlname, RTLD_NOW);
 	if (!dlh)