Advertisement
a3f

DllInject.c

a3f
Sep 13th, 2013
414
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.78 KB | None | 0 0
  1. #include <Rts.h>
  2. #include <windows.h>
  3. #include "../hs/kernel_stub.h"
  4.  
  5. extern void __stginit_Kernel(void);
  6.  
  7.  
  8. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID _Reserved)
  9. {
  10.   switch(dwReason)
  11.   {
  12.     case DLL_PROCESS_ATTACH:
  13.       //HookWinsockProcs();
  14.       return TRUE;
  15.     break;
  16.  
  17.     case DLL_THREAD_ATTACH:
  18.     break;
  19.  
  20.     case DLL_THREAD_DETACH:
  21.     break;
  22.  
  23.     case DLL_PROCESS_DETACH:
  24.       return TRUE;
  25.     break;
  26.     }
  27.  
  28.   return TRUE;
  29. }
  30.  
  31. void HsStart()
  32. {
  33.    int argc = 1;
  34.    char* argv[] = {"ghcDll", NULL}; // argv must end with NULL
  35.  
  36.    // Initialize Haskell runtime
  37.    char** args = argv;
  38.    hs_init(&argc, &args);
  39.  
  40.    // Tell Haskell about all root modules
  41.    hs_add_root(__stginit_Kernel);
  42. }
  43.  
  44. void HsEnd()
  45. {
  46.    hs_exit();
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement