source: golgotha/src/i4/dll/win32_dll.cc @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 12 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 1.1 KB
Line 
1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#include "dll/dll.hh"
10#include <windows.h>
11
12class i4_win32_dll_file : public i4_dll_file
13{
14
15  HINSTANCE handle;
16public:
17  i4_win32_dll_file(HINSTANCE handle) : handle(handle) {}
18
19  virtual ~i4_win32_dll_file()
20  {
21    FreeLibrary(handle);
22  }
23
24  virtual void *find_function(const char *name)
25  {
26    return GetProcAddress(handle, name);
27  } 
28};
29
30i4_dll_file *i4_open_dll(const i4_const_str &name)
31{
32  char buf[1024];
33  HINSTANCE handle=LoadLibrary(i4_os_string(name, buf, 1024));
34  if (handle)
35    return new i4_win32_dll_file(handle);   
36  else return 0;
37}
38
39
Note: See TracBrowser for help on using the repository browser.