Skip to content

Commit 43c306d

Browse files
committed
Fixed Linux linker error
1 parent ecebb32 commit 43c306d

File tree

2 files changed

+28
-24
lines changed

2 files changed

+28
-24
lines changed

src/core/modules/memory/memory_tools.h

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ using namespace boost::python;
4242

4343
// Externals
4444
extern DCCallVM* g_pCallVM;
45-
extern unsigned long ExtractPyPtr(object obj);
45+
4646

4747
//-----------------------------------------------------------------------------
4848
// Memory functions
@@ -244,6 +244,27 @@ class CPointer
244244
};
245245

246246

247+
//---------------------------------------------------------------------------------
248+
// Converts a Python CPointer object or an integer to an unsigned long.
249+
//---------------------------------------------------------------------------------
250+
inline unsigned long ExtractPyPtr(object obj)
251+
{
252+
// Try to get an unsigned long at first
253+
try
254+
{
255+
return extract<unsigned long>(obj);
256+
}
257+
catch(...)
258+
{
259+
PyErr_Clear();
260+
}
261+
262+
// If that fails, try to extract a CPointer representation
263+
CPointer* pPtr = extract<CPointer *>(obj);
264+
return pPtr->m_ulAddr;
265+
}
266+
267+
247268
class CFunction: public CPointer
248269
{
249270
public:
@@ -305,4 +326,4 @@ CPointer GetAddress(T* ptr)
305326
return CPointer((unsigned long) ptr);
306327
}
307328

308-
#endif // _MEMORY_TOOLS_H
329+
#endif // _MEMORY_TOOLS_H

src/core/utility/sp_util.h

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@
3232
#include "eiface.h"
3333
#include "public/game/server/iplayerinfo.h"
3434
#include "basehandle.h"
35-
#include "modules/memory/memory_tools.h"
35+
36+
#include "utility/wrap_macros.h"
37+
#include "boost/python.hpp"
38+
using namespace boost::python;
3639

3740
// Externals
3841
extern IVEngineServer* engine;
@@ -41,33 +44,13 @@ extern IPlayerInfoManager* playerinfomanager;
4144

4245

4346
//---------------------------------------------------------------------------------
44-
// Returns True if the class name equals the given string.
47+
// Returns True if the class name of the given object equals the given string.
4548
//---------------------------------------------------------------------------------
4649
inline bool CheckClassname(object obj, char* name)
4750
{
4851
return strcmp(extract<char *>(obj.attr("__class__").attr("__name__")), name) == 0;
4952
}
5053

51-
//---------------------------------------------------------------------------------
52-
// Converts a Python CPointer object or an integer to an unsigned long.
53-
//---------------------------------------------------------------------------------
54-
inline unsigned long ExtractPyPtr(object obj)
55-
{
56-
// Try to get an unsigned long at first
57-
try
58-
{
59-
return extract<unsigned long>(obj);
60-
}
61-
catch(...)
62-
{
63-
PyErr_Clear();
64-
}
65-
66-
// If that fails, try to extract a CPointer representation
67-
CPointer* pPtr = extract<CPointer *>(obj);
68-
return pPtr->m_ulAddr;
69-
}
70-
7154

7255
//---------------------------------------------------------------------------------
7356
// Helper template methods for __getitem__ and __setitem__

0 commit comments

Comments
 (0)