Skip to content

Commit 23ba4d7

Browse files
committed
xrCore: fix Linux build
1 parent 62858d0 commit 23ba4d7

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

src/Common/PlatformLinux.inl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ typedef dirent DirEntryType;
202202
#define _alloca alloca
203203
#define _snprintf snprintf
204204
#define sprintf_s(buffer, buffer_size, stringbuffer, ...) sprintf(buffer, stringbuffer, ##__VA_ARGS__)
205-
#define GetProcAddress(handle, name) dlsym(handle, name)
205+
//#define GetProcAddress(handle, name) dlsym(handle, name)
206206
#define _chdir chdir
207207
#define _strnicmp strnicmp
208208
#define strnicmp strncasecmp
@@ -217,6 +217,8 @@ typedef dirent DirEntryType;
217217
#define _open open
218218
#define _close close
219219
#define _sopen open
220+
#define _utime utime
221+
#define _utimbuf utimbuf
220222
#define _sopen_s(handle, filename, ...) open(filename, O_RDONLY)
221223
inline int _filelength(int fd)
222224
{
@@ -238,8 +240,6 @@ inline int _filelength(int fd)
238240
#undef max
239241
#define __max(a, b) std::max(a, b)
240242
#define __min(a, b) std::min(a, b)
241-
#define _utime utime
242-
#define _utimbuf utimbuf
243243

244244
#define xr_itoa SDL_itoa
245245

src/xrCore/ModuleLookup.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#include "stdafx.h"
22

33
#include "ModuleLookup.hpp"
4+
#ifdef LINUX
5+
#include <dlfcn.h>
6+
#endif
47

58
namespace XRay
69
{
@@ -13,20 +16,20 @@ ModuleHandle::ModuleHandle(pcstr moduleName, bool dontUnload /*= false*/) : hand
1316

1417
ModuleHandle::~ModuleHandle()
1518
{
16-
Сlose();
19+
Close();
1720
}
1821

1922
void* ModuleHandle::Open(pcstr moduleName)
2023
{
2124
if (IsLoaded())
22-
Сlose();
25+
Close();
2326

2427
Log("Loading DLL:", moduleName);
2528

2629
#ifdef WINDOWS
2730
handle = LoadLibraryA(moduleName);
2831
#elif defined(LINUX)
29-
handle = dlopen(name, RTLD_LAZY);
32+
handle = dlopen(moduleName, RTLD_LAZY);
3033
#endif
3134
if (handle == nullptr)
3235
{
@@ -40,7 +43,7 @@ void* ModuleHandle::Open(pcstr moduleName)
4043
return handle;
4144
}
4245

43-
void ModuleHandle::Сlose()
46+
void ModuleHandle::Close()
4447
{
4548
if (dontUnload)
4649
return;
@@ -49,7 +52,7 @@ void ModuleHandle::Сlose()
4952

5053
#ifdef WINDOWS
5154
closed = FreeLibrary(static_cast<HMODULE>(handle)) != 0;
52-
defined(LINUX)
55+
#elif defined(LINUX)
5356
closed = dlclose(handle) == 0;
5457
#endif
5558

@@ -82,7 +85,7 @@ void* ModuleHandle::GetProcAddress(pcstr procName) const
8285
#ifdef WINDOWS
8386
proc = ::GetProcAddress(static_cast<HMODULE>(handle), procName);
8487
#elif defined(LINUX)
85-
proc = dlsym(handle, procedure);
88+
proc = dlsym(handle, procName);
8689
#endif
8790

8891
if (proc == nullptr)

src/xrCore/ModuleLookup.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class XRCORE_API ModuleHandle
1414
~ModuleHandle();
1515

1616
void* Open(pcstr moduleName);
17-
void Сlose();
17+
void Close();
1818

1919
bool IsLoaded() const;
2020

0 commit comments

Comments
 (0)