janwas
9269be9ee3
(see http://www.wildfiregames.com/forum/index.php?showtopic=11450&hl= ) clean up debug module . no longer include platform-dependent header (-> less rebuilds) . DISPLAY_ERROR -> DEBUG_DISPLAY_ERROR . parts of config.h that don't affect all files moved to config.2 (-> fewer full rebuilds) . remove creaky symbol cache (no longer needed for mmgr) . remove TLS thread naming stuff (can use debugger's thread window instead; no need for platform independence there) wdbg: remove thread suspension and breakpoint APIs (not needed) acpi: fix: u64 -> uintptr_t wutil: fix WinScopedLock, use that instead of direct lock() functions misc: . get rid of SAFE_STRCPY, replace with strcpy_s . remove _getcwd (shouldn't be used) This was SVN commit r5563.
36 lines
944 B
C++
36 lines
944 B
C++
#ifndef INCLUDED_SHAREDMEMORY
|
|
#define INCLUDED_SHAREDMEMORY
|
|
|
|
// we want to use placement new without grief
|
|
// (Duplicated in Shareable.h)
|
|
#undef new
|
|
|
|
namespace AtlasMessage
|
|
{
|
|
|
|
// Shared pointers need to be allocated and freed from the same heap.
|
|
// So, both sides of the Shareable interface should set these function pointers
|
|
// to point to the same function. (The game will have to dynamically load them
|
|
// from the DLL.)
|
|
extern void* (*ShareableMallocFptr) (size_t n);
|
|
extern void (*ShareableFreeFptr) (void* p);
|
|
|
|
// Implement shared new/delete on top of those
|
|
template<typename T> T* ShareableNew()
|
|
{
|
|
T* p = (T*)ShareableMallocFptr(sizeof(T));
|
|
new (p) T;
|
|
return p;
|
|
}
|
|
template<typename T> void ShareableDelete(T* p)
|
|
{
|
|
p->~T();
|
|
ShareableFreeFptr(p);
|
|
}
|
|
// Or maybe we want to use a non-default constructor
|
|
#define SHAREABLE_NEW(T, data) (new ( (T*)AtlasMessage::ShareableMallocFptr(sizeof(T)) ) T data)
|
|
|
|
}
|
|
|
|
#endif // INCLUDED_SHAREDMEMORY
|