Anope IRC Services  Version 2.0
dl.cpp
Go to the documentation of this file.
1  /* POSIX emulation layer for Windows.
2  *
3  * Copyright (C) 2008-2014 Anope Team <team@anope.org>
4  *
5  * Please read COPYING and README for further details.
6  */
7 
8 #include "services.h"
9 #include "anope.h"
10 
11 void *dlopen(const char *filename, int)
12 {
13  return LoadLibrary(filename);
14 }
15 
16 char *dlerror(void)
17 {
18  static Anope::string err;
19  err = Anope::LastError();
20  SetLastError(0);
21  return err.empty() ? NULL : const_cast<char *>(err.c_str());
22 }
23 
24 void *dlsym(void *handle, const char *symbol)
25 {
26  return GetProcAddress(reinterpret_cast<HMODULE>(handle), symbol);
27 }
28 
29 int dlclose(void *handle)
30 {
31  return !FreeLibrary(reinterpret_cast<HMODULE>(handle));
32 }
CoreExport const string LastError()
Definition: misc.cpp:606
void * dlsym(void *handle, const char *symbol)
Definition: dl.cpp:24
bool empty() const
Definition: anope.h:126
int dlclose(void *handle)
Definition: dl.cpp:29
const char * c_str() const
Definition: anope.h:117
void * dlopen(const char *filename, int)
Definition: dl.cpp:11
char * dlerror(void)
Definition: dl.cpp:16