dl.cpp

Go to the documentation of this file.
00001  /* POSIX emulation layer for Windows.
00002  *
00003  * Copyright (C) 2008-2013 Anope Team <team@anope.org>
00004  *
00005  * Please read COPYING and README for further details.
00006  */
00007 
00008 #include "services.h"
00009 #include "anope.h"
00010 
00011 void *dlopen(const char *filename, int)
00012 {
00013         return LoadLibrary(filename);
00014 }
00015 
00016 char *dlerror(void)
00017 {
00018         static Anope::string err = Anope::LastError();
00019         SetLastError(0);
00020         return err.empty() ? NULL : const_cast<char *>(err.c_str());
00021 }
00022 
00023 void *dlsym(void *handle, const char *symbol)
00024 {
00025         return GetProcAddress(reinterpret_cast<HMODULE>(handle), symbol);
00026 }
00027 
00028 int dlclose(void *handle)
00029 {
00030         return !FreeLibrary(reinterpret_cast<HMODULE>(handle));
00031 }