#if (defined(FORCE_WINDOWS) || defined(_WIN32)) && !defined(FORCE_LINUX)
#define SWR_API __cdecl
-#define SWR_VISIBLE
+#define SWR_VISIBLE __declspec(dllexport)
#ifndef NOMINMAX
#define NOMINMAX
}
inline
-void *AlignedMalloc(unsigned int size, unsigned int alignment)
+void *AlignedMalloc(size_t size, size_t alignment)
{
void *ret;
if (posix_memalign(&ret, alignment, size))
return ret;
}
-inline
-unsigned char _bittest(const LONG *a, LONG b)
-{
- return ((*(unsigned *)(a) & (1 << b)) != 0);
-}
-
static inline
void AlignedFree(void* p)
{
#define sprintf_s sprintf
#define strcpy_s(dst,size,src) strncpy(dst,src,size)
#define GetCurrentProcessId getpid
-pid_t gettid(void);
-#define GetCurrentThreadId gettid
#define InterlockedCompareExchange(Dest, Exchange, Comparand) __sync_val_compare_and_swap(Dest, Comparand, Exchange)
#define InterlockedExchangeAdd(Addend, Value) __sync_fetch_and_add(Addend, Value)
#define PRAGMA_WARNING_PUSH_DISABLE(...)
#define PRAGMA_WARNING_POP()
+#define ZeroMemory(dst, size) memset(dst, 0, size)
#else
#error Unsupported OS/system.
void SWR_API SetCurrentThreadName(const char* pThreadName);
void SWR_API CreateDirectoryPath(const std::string& path);
+/// Execute Command (block until finished)
+/// @returns process exit value
+int SWR_API ExecCmd(
+ const std::string& cmd, ///< (In) Command line string
+ const char* pOptEnvStrings = nullptr, ///< (Optional In) Environment block for new process
+ std::string* pOptStdOut = nullptr, ///< (Optional Out) Standard Output text
+ std::string* pOptStdErr = nullptr, ///< (Optional Out) Standard Error text
+ const std::string* pOptStdIn = nullptr); ///< (Optional In) Standard Input text
+
#endif//__SWR_OS_H__