summaryrefslogtreecommitdiffstats
path: root/src/common/win32/dlfcn.cc
blob: 329d14677bd9d52927875a67a72fc3e09e6f4db5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
 * Ceph - scalable distributed file system
 *
 * Copyright (C) 2020 SUSE LINUX GmbH
 *
 * This is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License version 2.1, as published by the Free Software
 * Foundation.  See file COPYING.
 *
 */

#include <sstream>
#include <windows.h>

#include "common/errno.h"
#include "include/dlfcn_compat.h"


void* dlopen(const char *filename, int flags) {
  return LoadLibrary(filename);
}

int dlclose(void* handle) {
  //FreeLibrary returns 0 on error, as opposed to dlclose.
  return !FreeLibrary(handle);
}

void* dlsym(void* handle, const char* symbol) {
  return (void*)GetProcAddress(handle, symbol);
}

dl_errmsg_t dlerror() {
  return win32_lasterror_str();
}