Removes possibility to link lowlevel library dynamically.

Tested By: Langbart
Differential Revision: https://code.wildfiregames.com/D4470
This was SVN commit r26281.
This commit is contained in:
Vladislav Belov 2022-01-31 06:53:30 +00:00
parent 99118fc2b7
commit 8c068aab07
52 changed files with 271 additions and 369 deletions

View File

@ -206,10 +206,6 @@ function project_set_build_flags()
defines { "CONFIG2_MINIUPNPC=0" }
end
-- required for the lowlevel library. must be set from all projects that use it, otherwise it assumes it is
-- being used as a DLL (which is currently not the case in 0ad)
defines { "LIB_STATIC_LINK" }
-- Enable C++17 standard.
filter "action:vs*"
buildoptions { "/std:c++17" }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -58,7 +58,7 @@ struct DynArray
* (* rounded up to next page size multiple)
* @return Status.
**/
LIB_API Status da_alloc(DynArray* da, size_t max_size);
Status da_alloc(DynArray* da, size_t max_size);
/**
* free all memory (address space + physical) that constitutes the
@ -69,7 +69,7 @@ LIB_API Status da_alloc(DynArray* da, size_t max_size);
* @param da DynArray* zeroed afterwards.
* @return Status
**/
LIB_API Status da_free(DynArray* da);
Status da_free(DynArray* da);
/**
* expand or shrink the array: changes the amount of currently committed
@ -80,7 +80,7 @@ LIB_API Status da_free(DynArray* da);
* pages are added/removed until this is met.
* @return Status.
**/
LIB_API Status da_set_size(DynArray* da, size_t new_size);
Status da_set_size(DynArray* da, size_t new_size);
/**
* Make sure at least \<size\> bytes starting at da->pos are committed and
@ -90,7 +90,7 @@ LIB_API Status da_set_size(DynArray* da, size_t new_size);
* @param size Minimum amount to guarantee [bytes]
* @return Status
**/
LIB_API Status da_reserve(DynArray* da, size_t size);
Status da_reserve(DynArray* da, size_t size);
/**
* "write" to array, i.e. copy from the given buffer.
@ -102,6 +102,6 @@ LIB_API Status da_reserve(DynArray* da, size_t size);
* @param size [bytes] to copy
* @return Status.
**/
LIB_API Status da_append(DynArray* da, const void* data_src, size_t size);
Status da_append(DynArray* da, const void* data_src, size_t size);
#endif // #ifndef INCLUDED_ALLOCATORS_DYNARRAY

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -39,7 +39,7 @@
// @return the address of a sentinel element, suitable for initializing
// a freelist pointer. subsequent mem_freelist_Detach on that freelist
// will return 0.
LIB_API void* mem_freelist_Sentinel();
void* mem_freelist_Sentinel();
static inline void mem_freelist_AddToFront(void*& freelist, void* el)
{

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -27,11 +27,11 @@
// very thin wrapper on top of sys/mman.h that makes the intent more obvious
// (its commit/decommit semantics are difficult to tell apart)
LIB_API Status mem_Reserve(size_t size, u8** pp);
LIB_API Status mem_Release(u8* p, size_t size);
LIB_API Status mem_Commit(u8* p, size_t size, int prot);
LIB_API Status mem_Decommit(u8* p, size_t size);
LIB_API Status mem_Protect(u8* p, size_t size, int prot);
Status mem_Reserve(size_t size, u8** pp);
Status mem_Release(u8* p, size_t size);
Status mem_Commit(u8* p, size_t size, int prot);
Status mem_Decommit(u8* p, size_t size);
Status mem_Protect(u8* p, size_t size, int prot);
/**
@ -49,7 +49,7 @@ LIB_API Status mem_Protect(u8* p, size_t size, int prot);
* @param unaligned_size minimum size [bytes] to allocate.
* @return page-aligned and -padded memory or 0 on error / out of memory.
**/
LIB_API void* page_aligned_alloc(size_t unaligned_size);
void* page_aligned_alloc(size_t unaligned_size);
/**
* free a previously allocated page-aligned region.
@ -57,6 +57,6 @@ LIB_API void* page_aligned_alloc(size_t unaligned_size);
* @param p Exact value returned from page_aligned_alloc
* @param unaligned_size Exact value passed to page_aligned_alloc
**/
LIB_API void page_aligned_free(void* p, size_t unaligned_size);
void page_aligned_free(void* p, size_t unaligned_size);
#endif // #ifndef INCLUDED_ALLOCATORS_PAGE_ALIGNED

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2011 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -95,7 +95,7 @@ private:
void* freelist;
};
LIB_API void TestPool();
void TestPool();
} // namespace Allocators
@ -146,7 +146,7 @@ const size_t POOL_VARIABLE_ALLOCS = ~(size_t)0u;
* allow variable-sized allocations, but pool_free is then unusable.
* @return Status
**/
LIB_API Status pool_create(Pool* p, size_t max_size, size_t el_size);
Status pool_create(Pool* p, size_t max_size, size_t el_size);
/**
* free all memory (address space + physical) that constitutes the
@ -160,7 +160,7 @@ LIB_API Status pool_create(Pool* p, size_t max_size, size_t el_size);
* @param p Pool*
* @return Status.
**/
LIB_API Status pool_destroy(Pool* p);
Status pool_destroy(Pool* p);
/**
* indicate whether a pointer was allocated from the given pool.
@ -171,7 +171,7 @@ LIB_API Status pool_destroy(Pool* p);
* @param el
* @return bool.
**/
LIB_API bool pool_contains(const Pool* p, void* el);
bool pool_contains(const Pool* p, void* el);
/**
* Dole out memory from the pool.
@ -182,7 +182,7 @@ LIB_API bool pool_contains(const Pool* p, void* el);
* @return allocated memory, or 0 if the Pool would have to be expanded and
* there isn't enough memory to do so.
**/
LIB_API void* pool_alloc(Pool* p, size_t size);
void* pool_alloc(Pool* p, size_t size);
/**
* Make a fixed-size element available for reuse in the given Pool.
@ -194,7 +194,7 @@ LIB_API void* pool_alloc(Pool* p, size_t size);
* @param p Pool*
* @param el Element returned by pool_alloc.
**/
LIB_API void pool_free(Pool* p, void* el);
void pool_free(Pool* p, void* el);
/**
* "free" all user allocations that ensued from the given Pool.
@ -204,7 +204,7 @@ LIB_API void pool_free(Pool* p, void* el);
*
* @param p Pool*
**/
LIB_API void pool_free_all(Pool* p);
void pool_free_all(Pool* p);
/**
* Return the number of bytes committed in the pool's backing array.
@ -215,6 +215,6 @@ LIB_API void pool_free_all(Pool* p);
* @param p Pool*
* @return number of bytes
**/
LIB_API size_t pool_committed(Pool* p);
size_t pool_committed(Pool* p);
#endif // #ifndef INCLUDED_ALLOCATORS_POOL

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -50,7 +50,7 @@ struct ArrayDeleter
};
// (note: uses CheckedArrayDeleter)
LIB_API std::shared_ptr<u8> Allocate(size_t size);
std::shared_ptr<u8> Allocate(size_t size);
struct AlignedDeleter

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -149,7 +149,7 @@ struct AppHooks
* override the previous function pointer value
* (these default to the stub hooks which are functional but basic).
**/
LIB_API void app_hooks_update(AppHooks* ah);
void app_hooks_update(AppHooks* ah);
/**
* was the app hook changed via app_hooks_update from its default value?

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -93,38 +93,38 @@
#endif
/// read a little-endian number from memory into native byte order.
LIB_API u16 read_le16(const void* p);
LIB_API u32 read_le32(const void* p); /// see read_le16
LIB_API u64 read_le64(const void* p); /// see read_le16
u16 read_le16(const void* p);
u32 read_le32(const void* p); /// see read_le16
u64 read_le64(const void* p); /// see read_le16
/// read a big-endian number from memory into native byte order.
LIB_API u16 read_be16(const void* p);
LIB_API u32 read_be32(const void* p); /// see read_be16
LIB_API u64 read_be64(const void* p); /// see read_be16
u16 read_be16(const void* p);
u32 read_be32(const void* p); /// see read_be16
u64 read_be64(const void* p); /// see read_be16
/// write a little-endian number to memory in native byte order.
LIB_API void write_le16(void* p, u16 x);
LIB_API void write_le32(void* p, u32 x); /// see write_le16
LIB_API void write_le64(void* p, u64 x); /// see write_le16
void write_le16(void* p, u16 x);
void write_le32(void* p, u32 x); /// see write_le16
void write_le64(void* p, u64 x); /// see write_le16
/// write a big-endian number to memory in native byte order.
LIB_API void write_be16(void* p, u16 x);
LIB_API void write_be32(void* p, u32 x); /// see write_be16
LIB_API void write_be64(void* p, u64 x); /// see write_be16
void write_be16(void* p, u16 x);
void write_be32(void* p, u32 x); /// see write_be16
void write_be64(void* p, u64 x); /// see write_be16
/**
* zero-extend \<size\> (truncated to 8) bytes of little-endian data to u64,
* starting at address \<p\> (need not be aligned).
**/
LIB_API u64 movzx_le64(const u8* p, size_t size);
LIB_API u64 movzx_be64(const u8* p, size_t size);
u64 movzx_le64(const u8* p, size_t size);
u64 movzx_be64(const u8* p, size_t size);
/**
* sign-extend \<size\> (truncated to 8) bytes of little-endian data to i64,
* starting at address \<p\> (need not be aligned).
**/
LIB_API i64 movsx_le64(const u8* p, size_t size);
LIB_API i64 movsx_be64(const u8* p, size_t size);
i64 movsx_le64(const u8* p, size_t size);
i64 movsx_be64(const u8* p, size_t size);
#if ICC_VERSION
@ -154,13 +154,13 @@ extern unsigned __int64 _byteswap_uint64(unsigned __int64);
#endif
#ifndef swap16
LIB_API u16 swap16(const u16 x);
u16 swap16(const u16 x);
#endif
#ifndef swap32
LIB_API u32 swap32(const u32 x);
u32 swap32(const u32 x);
#endif
#ifndef swap64
LIB_API u64 swap64(const u64 x);
u64 swap64(const u64 x);
#endif
#endif // #ifndef INCLUDED_BYTE_ORDER

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -39,7 +39,6 @@
#include "lib/alignment.h"
#include "lib/code_annotation.h"
#include "lib/code_generation.h"
#include "lib/lib_api.h"
#include "lib/status.h"
#include "lib/types.h"
@ -66,7 +65,7 @@ extern void debug_break();
*
* @param fmt Format string and varargs; see printf.
**/
LIB_API void debug_printf(const char* fmt, ...) PRINTF_ARGS(1);
void debug_printf(const char* fmt, ...) PRINTF_ARGS(1);
/**
@ -75,7 +74,7 @@ LIB_API void debug_printf(const char* fmt, ...) PRINTF_ARGS(1);
* is unavailable because that function is much more capable.
* implemented via sys_display_msg; see documentation there.
**/
LIB_API void debug_DisplayMessage(const wchar_t* caption, const wchar_t* msg);
void debug_DisplayMessage(const wchar_t* caption, const wchar_t* msg);
/// flags to customize debug_DisplayError behavior
enum DebugDisplayErrorFlags
@ -191,7 +190,7 @@ enum ErrorReactionInternal
* provides the storage. values: see DEBUG_SUPPRESS above.
* @return ErrorReaction (user's choice: continue running or stop?)
**/
LIB_API ErrorReaction debug_DisplayError(const wchar_t* description, size_t flags, void* context, const wchar_t* lastFuncToSkip, const wchar_t* file, int line, const char* func, atomic_bool* suppress);
ErrorReaction debug_DisplayError(const wchar_t* description, size_t flags, void* context, const wchar_t* lastFuncToSkip, const wchar_t* file, int line, const char* func, atomic_bool* suppress);
// simplified version for just displaying an error message
#define DEBUG_DISPLAY_ERROR_IMPL(description, flags)\
@ -236,31 +235,31 @@ LIB_API ErrorReaction debug_DisplayError(const wchar_t* description, size_t flag
* in future, allow output with the given tag to proceed.
* no effect if already added.
**/
LIB_API void debug_filter_add(const char* tag);
void debug_filter_add(const char* tag);
/**
* in future, discard output with the given tag.
* no effect if not currently added.
**/
LIB_API void debug_filter_remove(const char* tag);
void debug_filter_remove(const char* tag);
/**
* clear all filter state; equivalent to debug_filter_remove for
* each tag that was debug_filter_add-ed.
**/
LIB_API void debug_filter_clear();
void debug_filter_clear();
/**
* indicate if the given text would be printed.
* useful for a series of debug_printfs - avoids needing to add a tag to
* each of their format strings.
**/
LIB_API bool debug_filter_allows(const char* text);
bool debug_filter_allows(const char* text);
/**
* call debug_puts if debug_filter_allows allows the string.
**/
LIB_API void debug_puts_filtered(const char* text);
void debug_puts_filtered(const char* text);
/**
* write an error description and all logs into crashlog.txt
@ -272,7 +271,7 @@ LIB_API void debug_puts_filtered(const char* text);
* @return Status; ERR::REENTERED if reentered via recursion or
* multithreading (not allowed since an infinite loop may result).
**/
LIB_API Status debug_WriteCrashlog(const char* text);
Status debug_WriteCrashlog(const char* text);
//-----------------------------------------------------------------------------
@ -364,7 +363,7 @@ LIB_API Status debug_WriteCrashlog(const char* text);
* @param func name of the function containing it
* @return ErrorReaction (user's choice: continue running or stop?)
**/
LIB_API ErrorReaction debug_OnAssertionFailure(const wchar_t* assert_expr, atomic_bool* suppress, const wchar_t* file, int line, const char* func) ANALYZER_NORETURN;
ErrorReaction debug_OnAssertionFailure(const wchar_t* assert_expr, atomic_bool* suppress, const wchar_t* file, int line, const char* func) ANALYZER_NORETURN;
/**
* called when a DEBUG_WARN_ERR indicates an error occurred;
@ -376,7 +375,7 @@ LIB_API ErrorReaction debug_OnAssertionFailure(const wchar_t* assert_expr, atomi
* @param func name of the function containing it
* @return ErrorReaction (user's choice: continue running or stop?)
**/
LIB_API ErrorReaction debug_OnError(Status err, atomic_bool* suppress, const wchar_t* file, int line, const char* func) ANALYZER_NORETURN;
ErrorReaction debug_OnError(Status err, atomic_bool* suppress, const wchar_t* file, int line, const char* func) ANALYZER_NORETURN;
/**
@ -393,12 +392,12 @@ LIB_API ErrorReaction debug_OnError(Status err, atomic_bool* suppress, const wch
* note: only one concurrent skip request is allowed; call
* debug_StopSkippingErrors before the next debug_SkipErrors.
*/
LIB_API void debug_SkipErrors(Status err);
void debug_SkipErrors(Status err);
/**
* @return how many errors were skipped since the call to debug_SkipErrors()
**/
LIB_API size_t debug_StopSkippingErrors();
size_t debug_StopSkippingErrors();
//-----------------------------------------------------------------------------
@ -455,7 +454,7 @@ static const size_t DEBUG_FILE_CHARS = 100;
* @return Status; INFO::OK iff any information was successfully
* retrieved and stored.
**/
LIB_API Status debug_ResolveSymbol(void* ptr_of_interest, wchar_t* sym_name, wchar_t* file, int* line);
Status debug_ResolveSymbol(void* ptr_of_interest, wchar_t* sym_name, wchar_t* file, int* line);
static const size_t DEBUG_CONTEXT_SIZE = 2048; // Win32 CONTEXT is currently 1232 bytes
@ -463,7 +462,7 @@ static const size_t DEBUG_CONTEXT_SIZE = 2048; // Win32 CONTEXT is currently 123
* @param context must point to an instance of the platform-specific type
* (e.g. CONTEXT) or CACHE_ALIGNED storage of DEBUG_CONTEXT_SIZE bytes.
**/
LIB_API Status debug_CaptureContext(void* context);
Status debug_CaptureContext(void* context);
/**
@ -486,7 +485,7 @@ LIB_API Status debug_CaptureContext(void* context);
* @return Status; ERR::REENTERED if reentered via recursion or
* multithreading (not allowed since static data is used).
**/
LIB_API Status debug_DumpStack(wchar_t* buf, size_t maxChars, void* context, const wchar_t* lastFuncToSkip);
Status debug_DumpStack(wchar_t* buf, size_t maxChars, void* context, const wchar_t* lastFuncToSkip);
//-----------------------------------------------------------------------------
@ -498,7 +497,7 @@ LIB_API Status debug_DumpStack(wchar_t* buf, size_t maxChars, void* context, con
* this can be quite slow (~1 ms)! On Windows, it uses OutputDebugString
* (entails context switch), otherwise stdout+fflush (waits for IO).
**/
LIB_API void debug_puts(const char* text);
void debug_puts(const char* text);
/**
* return the caller of a certain function on the call stack.
@ -509,7 +508,7 @@ LIB_API void debug_puts(const char* text);
* @param context, lastFuncToSkip - see debug_DumpStack
* @return address of the caller
**/
LIB_API void* debug_GetCaller(void* context, const wchar_t* lastFuncToSkip);
void* debug_GetCaller(void* context, const wchar_t* lastFuncToSkip);
/**
* check if a pointer appears to be totally invalid.
@ -520,13 +519,13 @@ LIB_API void* debug_GetCaller(void* context, const wchar_t* lastFuncToSkip);
* @param p pointer
* @return 1 if totally bogus, otherwise 0.
**/
LIB_API int debug_IsPointerBogus(const void* p);
int debug_IsPointerBogus(const void* p);
/// does the given pointer appear to point to code?
LIB_API bool debug_IsCodePointer(void* p);
bool debug_IsCodePointer(void* p);
/// does the given pointer appear to point to the stack?
LIB_API bool debug_IsStackPointer(void* p);
bool debug_IsStackPointer(void* p);
/**
@ -535,7 +534,7 @@ LIB_API bool debug_IsStackPointer(void* p);
* (threads are easier to keep apart when they are identified by
* name rather than TID.)
**/
LIB_API void debug_SetThreadName(const char* name);
void debug_SetThreadName(const char* name);
/**
* build a string describing the given error.
@ -548,6 +547,6 @@ LIB_API void debug_SetThreadName(const char* name);
* @param line, func: exact position of the error.
* @param context, lastFuncToSkip: see debug_DumpStack.
**/
LIB_API const wchar_t* debug_BuildErrorMessage(const wchar_t* description, const wchar_t* fn_only, int line, const char* func, void* context, const wchar_t* lastFuncToSkip);
const wchar_t* debug_BuildErrorMessage(const wchar_t* description, const wchar_t* fn_only, int line, const char* func, void* context, const wchar_t* lastFuncToSkip);
#endif // #ifndef INCLUDED_DEBUG

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -32,11 +32,11 @@
/**
* @return 0 if opening the archive failed (e.g. because an external program is holding on to it)
**/
LIB_API PIArchiveReader CreateArchiveReader_Zip(const OsPath& archivePathname);
PIArchiveReader CreateArchiveReader_Zip(const OsPath& archivePathname);
/**
* @return 0 if opening the archive failed (e.g. because an external program is holding on to it)
**/
LIB_API PIArchiveWriter CreateArchiveWriter_Zip(const OsPath& archivePathname, bool noDeflate);
PIArchiveWriter CreateArchiveWriter_Zip(const OsPath& archivePathname, bool noDeflate);
#endif // #ifndef INCLUDED_ARCHIVE_ZIP

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -39,8 +39,8 @@ namespace ERR
// @param oflag: either O_RDONLY or O_WRONLY (in which case O_CREAT and
// O_TRUNC are added), plus O_DIRECT if aio is desired
// @return file descriptor or a negative Status
LIB_API Status FileOpen(const OsPath& pathname, int oflag);
LIB_API void FileClose(int& fd);
Status FileOpen(const OsPath& pathname, int oflag);
void FileClose(int& fd);
class File
{

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -32,10 +32,10 @@
#include <vector>
LIB_API bool DirectoryExists(const OsPath& path);
LIB_API bool FileExists(const OsPath& pathname);
bool DirectoryExists(const OsPath& path);
bool FileExists(const OsPath& pathname);
LIB_API u64 FileSize(const OsPath& pathname);
u64 FileSize(const OsPath& pathname);
// (bundling size and mtime avoids a second expensive call to stat())
@ -72,22 +72,22 @@ private:
time_t mtime;
};
LIB_API Status GetFileInfo(const OsPath& pathname, CFileInfo* fileInfo);
Status GetFileInfo(const OsPath& pathname, CFileInfo* fileInfo);
typedef std::vector<CFileInfo> CFileInfos;
typedef std::vector<OsPath> DirectoryNames;
LIB_API Status GetDirectoryEntries(const OsPath& path, CFileInfos* files, DirectoryNames* subdirectoryNames);
Status GetDirectoryEntries(const OsPath& path, CFileInfos* files, DirectoryNames* subdirectoryNames);
// same as boost::filesystem::create_directories, except that mkdir is invoked with
// <mode> instead of 0755.
// If the breakpoint is enabled, debug_break will be called if the directory didn't exist and couldn't be created.
LIB_API Status CreateDirectories(const OsPath& path, mode_t mode, bool breakpoint = true);
Status CreateDirectories(const OsPath& path, mode_t mode, bool breakpoint = true);
LIB_API Status DeleteDirectory(const OsPath& dirPath);
Status DeleteDirectory(const OsPath& dirPath);
LIB_API Status CopyFile(const OsPath& path, const OsPath& newPath, bool override_if_exists = false);
Status CopyFile(const OsPath& path, const OsPath& newPath, bool override_if_exists = false);
LIB_API Status RenameFile(const OsPath& path, const OsPath& newPath);
Status RenameFile(const OsPath& path, const OsPath& newPath);
#endif // #ifndef INCLUDED_FILE_SYSTEM

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -226,8 +226,8 @@ private:
#pragma pack(pop)
LIB_API Status Issue(aiocb& cb, size_t queueDepth);
LIB_API Status WaitUntilComplete(aiocb& cb, size_t queueDepth);
Status Issue(aiocb& cb, size_t queueDepth);
Status WaitUntilComplete(aiocb& cb, size_t queueDepth);
//-----------------------------------------------------------------------------

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -225,6 +225,6 @@ typedef std::shared_ptr<IVFS> PIVFS;
* note: there is no limitation to a single instance, it may make sense
* to create and destroy VFS instances during each unit test.
**/
LIB_API PIVFS CreateVfs();
PIVFS CreateVfs();
#endif // #ifndef INCLUDED_VFS

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -40,6 +40,6 @@ struct IFrequencyFilter
typedef std::shared_ptr<IFrequencyFilter> PIFrequencyFilter;
// expectedFrequency is a guess that hopefully speeds up convergence
LIB_API PIFrequencyFilter CreateFrequencyFilter(double resolution, double expectedFrequency);
PIFrequencyFilter CreateFrequencyFilter(double resolution, double expectedFrequency);
#endif // #ifndef INCLUDED_FREQUENCY_FILTER

View File

@ -1,56 +0,0 @@
/* Copyright (C) 2021 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef INCLUDED_LIB_API
#define INCLUDED_LIB_API
#include "lib/sysdep/compiler.h"
// note: EXTERN_C cannot be used because std::shared_ptr is often returned
// by value, which requires C++ linkage.
#ifdef LIB_STATIC_LINK
# define LIB_API
#else
# if MSC_VERSION
# ifdef LIB_BUILD
# define LIB_API __declspec(dllexport)
# else
# define LIB_API __declspec(dllimport)
# ifdef NDEBUG
# pragma comment(lib, "lowlevel.lib")
# else
# pragma comment(lib, "lowlevel_d.lib")
# endif
# endif
# elif GCC_VERSION
# ifdef LIB_BUILD
# define LIB_API __attribute__ ((visibility("default")))
# else
# define LIB_API
# endif
# else
# error "Don't know how to define LIB_API for this compiler"
# endif
#endif
#endif // #ifndef INCLUDED_LIB_API

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -50,7 +50,7 @@ typedef intptr_t ModuleInitState; // intptr_t is required by cpu_CAS
* note that callbacks typically reference static data and thus do not
* require a function argument, but that can later be added if necessary.
**/
LIB_API Status ModuleInit(volatile ModuleInitState* initState, Status (*init)());
Status ModuleInit(volatile ModuleInitState* initState, Status (*init)());
/**
* calls a user-defined shutdown function if initState is "initialized".
@ -69,6 +69,6 @@ LIB_API Status ModuleInit(volatile ModuleInitState* initState, Status (*init)())
* cleanup is necessary (e.g. at exit before leak reporting) and
* it is certain that the module is no longer in use.
**/
LIB_API Status ModuleShutdown(volatile ModuleInitState* initState, void (*shutdown)());
Status ModuleShutdown(volatile ModuleInitState* initState, void (*shutdown)());
#endif // #ifndef INCLUDED_MODULE_INIT

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -57,7 +57,7 @@ namespace ERR
* @param s1, s2 comparand strings
* @return bool
**/
LIB_API bool path_is_subpath(const wchar_t* s1, const wchar_t* s2);
bool path_is_subpath(const wchar_t* s1, const wchar_t* s2);
/**
* Get the path component of a path.
@ -66,7 +66,7 @@ LIB_API bool path_is_subpath(const wchar_t* s1, const wchar_t* s2);
* @param path Input path.
* @return pointer to path component within \<path\>.
**/
LIB_API const wchar_t* path_name_only(const wchar_t* path);
const wchar_t* path_name_only(const wchar_t* path);
// NB: there is a need for 'generic' paths (e.g. for Trace entry / archive pathnames).

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -29,14 +29,6 @@
# define BOOST_HAS_STDINT_H
#endif
// Boost
// .. if this package isn't going to be statically linked, we're better off
// using Boost via DLL. (otherwise, we would have to ensure the exact same
// compiler is used, which is a pain because MSC8, MSC9 and ICC 10 are in use)
#ifndef LIB_STATIC_LINK
# define BOOST_ALL_DYN_LINK
#endif
// don't compile get_system_category() etc, since we don't use them and they
// sometimes cause problems when linking.
// But Filesystem <= 1.43 requires boost::system::posix, so only disable if newer

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -69,7 +69,6 @@ double __cdecl abs(double x); // not declared by mathimf
#include "lib/sysdep/arch.h"
#include "lib/sysdep/os.h"
#include "lib/sysdep/stl.h"
#include "lib/lib_api.h"
#include "lib/types.h"
#include "lib/debug.h"
#include "lib/lib.h"

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -32,6 +32,7 @@
* avoids several common pitfalls; see discussion at
* http://www.azillionmonkeys.com/qed/random.html
**/
LIB_API size_t rand(size_t min_inclusive, size_t max_exclusive);
// TODO: replace the function by STL distributions.
size_t rand(size_t min_inclusive, size_t max_exclusive);
#endif // #ifndef INCLUDED_RAND

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2011 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -161,8 +161,6 @@ To summarize: +/-1SHHCC (S=subsystem, HH=header, CC=code number)
#ifndef INCLUDED_STATUS
#define INCLUDED_STATUS
#include "lib/lib_api.h"
// an integral type allows defining error codes in separate headers,
// but is not as type-safe as an enum. use Lint's 'strong type' checking
// to catch errors such as Status Func() { return 1; }.
@ -206,7 +204,7 @@ struct StatusDefinitionBucket // POD
* (this function must be callable as a static initializer; initializing
* next avoids the need for a separate dummy variable)
**/
LIB_API StatusDefinitionBucket* StatusAddDefinitions(StatusDefinitionBucket* bucket);
StatusDefinitionBucket* StatusAddDefinitions(StatusDefinitionBucket* bucket);
/**
* add a module's array of StatusDefinition to the list.
@ -224,7 +222,7 @@ LIB_API StatusDefinitionBucket* StatusAddDefinitions(StatusDefinitionBucket* buc
* @param max_chars size of buffer [characters]
* @return buf (allows using this function in expressions)
**/
LIB_API wchar_t* StatusDescription(Status status, wchar_t* buf, size_t max_chars);
wchar_t* StatusDescription(Status status, wchar_t* buf, size_t max_chars);
/**
* @return the errno equivalent of a Status.

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -41,6 +41,6 @@
*
* this function is used for walking the call stack.
**/
LIB_API Status ia32_GetCallTarget(void* ret_addr, void*& target);
Status ia32_GetCallTarget(void* ret_addr, void*& target);
#endif // #ifndef INCLUDED_IA32

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -33,20 +33,20 @@ typedef u8 ApicId; // not necessarily contiguous values
* feasible. We also don't want to interfere with the OS's constant use of
* the APIC registers.
**/
LIB_API ApicId GetApicId();
ApicId GetApicId();
// if this returns false, apicId = contiguousId = processor.
// otherwise, there are unspecified but bijective mappings between
// apicId<->contiguousId and apicId<->processor.
LIB_API bool AreApicIdsReliable();
bool AreApicIdsReliable();
// we may get the apicId of a processor we don't have access to.
LIB_API bool IsProcessorKnown(ApicId apicId);
bool IsProcessorKnown(ApicId apicId);
LIB_API size_t ProcessorFromApicId(ApicId apicId);
LIB_API size_t ContiguousIdFromApicId(ApicId apicId);
size_t ProcessorFromApicId(ApicId apicId);
size_t ContiguousIdFromApicId(ApicId apicId);
LIB_API ApicId ApicIdFromProcessor(size_t contiguousId);
LIB_API ApicId ApicIdFromContiguousId(size_t contiguousId);
ApicId ApicIdFromProcessor(size_t contiguousId);
ApicId ApicIdFromContiguousId(size_t contiguousId);
#endif // #ifndef INCLUDED_X86_X64_APIC

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -27,8 +27,6 @@
#ifndef INCLUDED_X86_X64
#define INCLUDED_X86_X64
#include "lib/lib_api.h"
#if !ARCH_X86_X64
#error "including x86_x64.h without ARCH_X86_X64=1"
#endif
@ -62,7 +60,7 @@ struct CpuidRegs
* and allows graceful expansion to functions that require further inputs.
* @return true on success or false if the sub-function isn't supported.
**/
LIB_API bool cpuid(CpuidRegs* regs);
bool cpuid(CpuidRegs* regs);
/**
* CPU vendor.
@ -76,7 +74,7 @@ enum Vendors
VENDOR_AMD
};
LIB_API Vendors Vendor();
Vendors Vendor();
enum Models
@ -92,16 +90,16 @@ enum Models
MODEL_SANDY_BRIDGE_2 = 0x2D, // (E5-26xx, E5-46xx)
};
LIB_API size_t Model();
size_t Model();
LIB_API size_t Family();
size_t Family();
/**
* @return the colloquial processor generation
* (5 = Pentium, 6 = Pentium Pro/II/III / K6, 7 = Pentium4 / Athlon, 8 = Core / Opteron)
**/
LIB_API size_t Generation();
size_t Generation();
/**
@ -141,9 +139,9 @@ enum Caps
/**
* @return whether the CPU supports the indicated Cap / feature flag.
**/
LIB_API bool Cap(Caps cap);
bool Cap(Caps cap);
LIB_API void GetCapBits(u32* d0, u32* d1, u32* d2, u32* d3);
void GetCapBits(u32* d0, u32* d1, u32* d2, u32* d3);
//-----------------------------------------------------------------------------
@ -161,13 +159,13 @@ LIB_API void GetCapBits(u32* d0, u32* d1, u32* d2, u32* d3);
#if MSC_VERSION
static inline u64 rdtsc() { return __rdtsc(); }
#else
LIB_API u64 rdtsc();
u64 rdtsc();
#endif
/**
* trigger a breakpoint inside this function when it is called.
**/
LIB_API void DebugBreak();
void DebugBreak();
/**
* measure the CPU clock frequency via rdtsc and timer_Time.
@ -175,7 +173,7 @@ LIB_API void DebugBreak();
* this takes several milliseconds (i.e. much longer than
* os_cpu_ClockFrequency) but delivers accurate measurements.
**/
LIB_API double ClockFrequency();
double ClockFrequency();
} // namespace x86_x64

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -46,7 +46,7 @@ namespace ERR
* @return string identifying the CPU (usually a cleaned-up version of the
* brand string)
**/
LIB_API const char* cpu_IdentifierString();
const char* cpu_IdentifierString();
//-----------------------------------------------------------------------------
@ -58,7 +58,7 @@ LIB_API const char* cpu_IdentifierString();
*
* @return the previous value.
**/
LIB_API intptr_t cpu_AtomicAdd(volatile intptr_t* location, intptr_t increment);
intptr_t cpu_AtomicAdd(volatile intptr_t* location, intptr_t increment);
/**
* atomic "compare and swap".
@ -69,8 +69,8 @@ LIB_API intptr_t cpu_AtomicAdd(volatile intptr_t* location, intptr_t increment);
* @return false if the target word doesn't match the expected value,
* otherwise true (also overwriting the contents of location)
**/
LIB_API bool cpu_CAS(volatile intptr_t* location, intptr_t expected, intptr_t newValue);
LIB_API bool cpu_CAS64(volatile i64* location, i64 expected, i64 newValue);
bool cpu_CAS(volatile intptr_t* location, intptr_t expected, intptr_t newValue);
bool cpu_CAS64(volatile i64* location, i64 expected, i64 newValue);
/**
* specialization of cpu_CAS for pointer types. this avoids error-prone
@ -83,7 +83,7 @@ inline bool cpu_CAS(volatile T* location, T expected, T new_value)
}
LIB_API void cpu_Test();
void cpu_Test();
/**
* pause in spin-wait loops, as a performance optimisation.

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -52,7 +52,7 @@ typedef std::shared_ptr<DirWatch> PDirWatch;
* convenient to store PDirWatch there instead of creating a second
* tree structure here.
**/
LIB_API Status dir_watch_Add(const OsPath& path, PDirWatch& dirWatch);
Status dir_watch_Add(const OsPath& path, PDirWatch& dirWatch);
class DirWatchNotification
{
@ -99,6 +99,6 @@ typedef std::vector<DirWatchNotification> DirWatchNotifications;
* typically want to receive change notifications at a single point,
* rather than deal with the complexity of asynchronous notifications.
**/
LIB_API Status dir_watch_Poll(DirWatchNotifications& notifications);
Status dir_watch_Poll(DirWatchNotifications& notifications);
#endif // #ifndef INCLUDED_DIR_WATCH

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -91,26 +91,26 @@ extern int wclose(int fd);
// however, ftruncate cannot be used since it is also subject to the
// sector-alignment requirement. instead, the file must be closed and
// this function called.
LIB_API int wtruncate(const OsPath& pathname, off_t length);
int wtruncate(const OsPath& pathname, off_t length);
LIB_API int wunlink(const OsPath& pathname);
int wunlink(const OsPath& pathname);
LIB_API int wrmdir(const OsPath& path);
int wrmdir(const OsPath& path);
//
// stdlib.h
//
LIB_API OsPath wrealpath(const OsPath& pathname);
OsPath wrealpath(const OsPath& pathname);
//
// sys/stat.h
//
LIB_API int wstat(const OsPath& pathname, struct stat* buf);
int wstat(const OsPath& pathname, struct stat* buf);
LIB_API int wmkdir(const OsPath& path, mode_t mode);
int wmkdir(const OsPath& path, mode_t mode);
#endif // #ifndef INCLUDED_SYSDEP_FILESYSTEM

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -29,19 +29,19 @@
/**
* @return number of NUMA "nodes" (i.e. groups of CPUs with local memory).
**/
LIB_API size_t numa_NumNodes();
size_t numa_NumNodes();
/**
* @param processor
* @return node number (zero-based) to which \<processor\> belongs.
**/
LIB_API size_t numa_NodeFromProcessor(size_t processor);
size_t numa_NodeFromProcessor(size_t processor);
/**
* @param node
* @return bit-mask of all processors constituting \<node\>.
**/
LIB_API uintptr_t numa_ProcessorMaskFromNode(size_t node);
uintptr_t numa_ProcessorMaskFromNode(size_t node);
//-----------------------------------------------------------------------------
@ -52,7 +52,7 @@ LIB_API uintptr_t numa_ProcessorMaskFromNode(size_t node);
* @param node
* @return bytes of memory available for allocation on \<node\>.
**/
LIB_API size_t numa_AvailableMemory(size_t node);
size_t numa_AvailableMemory(size_t node);
/**
* @return the ratio between maximum and minimum times that one processor
@ -60,7 +60,7 @@ LIB_API size_t numa_AvailableMemory(size_t node);
* in other words, this is the maximum slowdown for NUMA-oblivious
* memory accesses. Microsoft guidelines require it to be <= 3.
**/
LIB_API double numa_Factor();
double numa_Factor();
/**
* @return an indication of whether memory pages are node-interleaved.
@ -69,6 +69,6 @@ LIB_API double numa_Factor();
* least-permission accounts. the default is to return false so as
* not to cause callers to panic and trigger performance warnings.
**/
LIB_API bool numa_IsMemoryInterleaved();
bool numa_IsMemoryInterleaved();
#endif // #ifndef INCLUDED_NUMA

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -101,11 +101,11 @@ struct FADT // signature is FACP!
* note: the first call may be slow, e.g. if a kernel-mode driver is
* loaded. subsequent requests will be faster since tables are cached.
**/
LIB_API const AcpiTable* acpi_GetTable(const char* signature);
const AcpiTable* acpi_GetTable(const char* signature);
/**
* invalidates all pointers returned by acpi_GetTable.
**/
LIB_API void acpi_Shutdown();
void acpi_Shutdown();
#endif // #ifndef INCLUDED_ACPI

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2015 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -33,7 +33,7 @@ to add the necessary parts to that generated manifest.
ICC 10.1 IPO considers this string to be an input file, hence this
is currently disabled there.
*/
#if MSC_VERSION >= 1400 && !ICC_VERSION && defined(LIB_STATIC_LINK)
#if MSC_VERSION >= 1400 && !ICC_VERSION
# if ARCH_IA32
# pragma comment(linker, "\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='X86' publicKeyToken='6595b64144ccf1df'\"")
# elif ARCH_AMD64

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -34,7 +34,7 @@
* this function does not allocate memory from the CRT heap, which makes it
* safe to use from an allocation hook.
**/
LIB_API void wdbg_printf(const wchar_t* fmt, ...);
void wdbg_printf(const wchar_t* fmt, ...);
/**
* similar to ENSURE but safe to use during critical init or

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -40,7 +40,7 @@
* enable or disable manual and automatic heap validity checking.
* (enabled by default during critical_init.)
**/
LIB_API void wdbg_heap_Enable(bool);
void wdbg_heap_Enable(bool);
/**
* check heap integrity.
@ -48,12 +48,12 @@ LIB_API void wdbg_heap_Enable(bool);
* no effect if called between wdbg_heap_Enable(false) and the next
* wdbg_heap_Enable(true).
**/
LIB_API void wdbg_heap_Validate();
void wdbg_heap_Validate();
/**
* @return the total number of alloc and realloc operations thus far.
* used by the in-game profiler.
**/
LIB_API intptr_t wdbg_heap_NumberOfAllocations();
intptr_t wdbg_heap_NumberOfAllocations();
#endif // #ifndef INCLUDED_WDBG_HEAP

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -59,8 +59,8 @@ typedef Status (*StackFrameCallback)(const _tagSTACKFRAME64* frame, uintptr_t cb
* stack trace (which is triggered by ENSURE et al. in app code) because
* nested stack traces are ignored and only the error is displayed.
**/
LIB_API Status wdbg_sym_WalkStack(StackFrameCallback cb, uintptr_t cbData, CONTEXT& context, const wchar_t* lastFuncToSkip = 0);
Status wdbg_sym_WalkStack(StackFrameCallback cb, uintptr_t cbData, CONTEXT& context, const wchar_t* lastFuncToSkip = 0);
LIB_API void wdbg_sym_WriteMinidump(EXCEPTION_POINTERS* ep);
void wdbg_sym_WriteMinidump(EXCEPTION_POINTERS* ep);
#endif // #ifndef INCLUDED_WDBG_SYM

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2011 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -138,6 +138,6 @@ extern Status waio_close(int fd);
// this function sets the valid data length to avoid the synchronous zero-fill.
// to avoid exposing the previous disk contents until the application
// successfully writes to the file, deny sharing when opening the file.
LIB_API Status waio_Preallocate(int fd, off_t size);
Status waio_Preallocate(int fd, off_t size);
#endif // #ifndef INCLUDED_WAIO

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -34,9 +34,9 @@
#define RTLD_GLOBAL 0x04 // semantics are unsupported, so complain if set.
#define RTLD_LOCAL 0x08
LIB_API int dlclose(void* handle);
LIB_API char* dlerror();
LIB_API void* dlopen(const char* so_name, int flags);
LIB_API void* dlsym(void* handle, const char* sym_name);
int dlclose(void* handle);
char* dlerror();
void* dlopen(const char* so_name, int flags);
void* dlsym(void* handle, const char* sym_name);
#endif // #ifndef INCLUDED_WDLFCN

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2011 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -57,6 +57,6 @@ extern int munmap(void* start, size_t len);
extern int mprotect(void* addr, size_t len, int prot);
// convert POSIX PROT_* flags to their Win32 PAGE_* enumeration equivalents.
LIB_API unsigned MemoryProtectionFromPosix(int prot);
unsigned MemoryProtectionFromPosix(int prot);
#endif // #ifndef INCLUDED_WMMAN

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -52,7 +52,7 @@
// <stdlib.h>
//
LIB_API int setenv(const char* envname, const char* envval, int overwrite);
int setenv(const char* envname, const char* envval, int overwrite);
//

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -57,45 +57,45 @@ enum
typedef intptr_t pthread_once_t; // required for cpu_CAS
#define PTHREAD_ONCE_INIT 0 // static pthread_once_t x = PTHREAD_ONCE_INIT;
LIB_API int pthread_once(pthread_once_t*, void (*init_routine)());
int pthread_once(pthread_once_t*, void (*init_routine)());
// thread
typedef uintptr_t pthread_t;
LIB_API int pthread_equal(pthread_t t1, pthread_t t2);
LIB_API pthread_t pthread_self();
LIB_API int pthread_getschedparam(pthread_t thread, int* policy, struct sched_param* param);
LIB_API int pthread_setschedparam(pthread_t thread, int policy, const struct sched_param* param);
LIB_API int pthread_create(pthread_t* thread, const void* attr, void* (*func)(void*), void* arg);
LIB_API int pthread_cancel(pthread_t thread);
LIB_API int pthread_join(pthread_t thread, void** value_ptr);
int pthread_equal(pthread_t t1, pthread_t t2);
pthread_t pthread_self();
int pthread_getschedparam(pthread_t thread, int* policy, struct sched_param* param);
int pthread_setschedparam(pthread_t thread, int policy, const struct sched_param* param);
int pthread_create(pthread_t* thread, const void* attr, void* (*func)(void*), void* arg);
int pthread_cancel(pthread_t thread);
int pthread_join(pthread_t thread, void** value_ptr);
// mutex
typedef void* pthread_mutexattr_t;
LIB_API int pthread_mutexattr_init(pthread_mutexattr_t* attr);
LIB_API int pthread_mutexattr_destroy(pthread_mutexattr_t* attr);
int pthread_mutexattr_init(pthread_mutexattr_t* attr);
int pthread_mutexattr_destroy(pthread_mutexattr_t* attr);
enum { PTHREAD_MUTEX_RECURSIVE }; // the only one we support
LIB_API int pthread_mutexattr_gettype(const pthread_mutexattr_t* attr, int* type);
LIB_API int pthread_mutexattr_settype(pthread_mutexattr_t* attr, int type);
int pthread_mutexattr_gettype(const pthread_mutexattr_t* attr, int* type);
int pthread_mutexattr_settype(pthread_mutexattr_t* attr, int type);
typedef void* pthread_mutex_t; // pointer to critical section
LIB_API pthread_mutex_t pthread_mutex_initializer();
pthread_mutex_t pthread_mutex_initializer();
#define PTHREAD_MUTEX_INITIALIZER pthread_mutex_initializer()
LIB_API int pthread_mutex_init(pthread_mutex_t*, const pthread_mutexattr_t*);
LIB_API int pthread_mutex_destroy(pthread_mutex_t*);
LIB_API int pthread_mutex_lock(pthread_mutex_t*);
LIB_API int pthread_mutex_trylock(pthread_mutex_t*);
LIB_API int pthread_mutex_unlock(pthread_mutex_t*);
LIB_API int pthread_mutex_timedlock(pthread_mutex_t*, const struct timespec*);
int pthread_mutex_init(pthread_mutex_t*, const pthread_mutexattr_t*);
int pthread_mutex_destroy(pthread_mutex_t*);
int pthread_mutex_lock(pthread_mutex_t*);
int pthread_mutex_trylock(pthread_mutex_t*);
int pthread_mutex_unlock(pthread_mutex_t*);
int pthread_mutex_timedlock(pthread_mutex_t*, const struct timespec*);
// thread-local storage
typedef unsigned int pthread_key_t;
LIB_API int pthread_key_create(pthread_key_t*, void (*dtor)(void*));
LIB_API int pthread_key_delete(pthread_key_t);
LIB_API void* pthread_getspecific(pthread_key_t);
LIB_API int pthread_setspecific(pthread_key_t, const void* value);
int pthread_key_create(pthread_key_t*, void (*dtor)(void*));
int pthread_key_delete(pthread_key_t);
void* pthread_getspecific(pthread_key_t);
int pthread_setspecific(pthread_key_t, const void* value);
//
@ -106,14 +106,14 @@ typedef uintptr_t sem_t;
#define SEM_FAILED 0
LIB_API sem_t* sem_open(const char* name, int oflag, ...);
LIB_API int sem_close(sem_t* sem);
LIB_API int sem_unlink(const char* name);
LIB_API int sem_init(sem_t*, int pshared, unsigned value);
LIB_API int sem_destroy(sem_t*);
LIB_API int sem_post(sem_t*);
LIB_API int sem_wait(sem_t*);
LIB_API int sem_timedwait(sem_t*, const struct timespec*);
sem_t* sem_open(const char* name, int oflag, ...);
int sem_close(sem_t* sem);
int sem_unlink(const char* name);
int sem_init(sem_t*, int pshared, unsigned value);
int sem_destroy(sem_t*);
int sem_post(sem_t*);
int sem_wait(sem_t*);
int sem_timedwait(sem_t*, const struct timespec*);
// wait until semaphore is locked or a message arrives. non-portable.
@ -130,6 +130,6 @@ LIB_API int sem_timedwait(sem_t*, const struct timespec*);
// -1 otherwise. errno differentiates what happened: ETIMEDOUT if a
// message arrived (this is to ease switching between message waiting and
// periodic timeout), or an error indication.
LIB_API int sem_msgwait_np(sem_t* sem);
int sem_msgwait_np(sem_t* sem);
#endif // #ifndef INCLUDED_WPTHREAD

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -40,8 +40,8 @@ typedef long suseconds_t;
// <unistd.h>
//
LIB_API unsigned sleep(unsigned sec);
LIB_API int usleep(useconds_t us);
unsigned sleep(unsigned sec);
int usleep(useconds_t us);
//
@ -50,6 +50,6 @@ LIB_API int usleep(useconds_t us);
extern int nanosleep(const struct timespec* rqtp, struct timespec* rmtp);
LIB_API char* strptime(const char* buf, const char* format, struct tm* timeptr);
char* strptime(const char* buf, const char* format, struct tm* timeptr);
#endif // #ifndef INCLUDED_WTIME

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -36,7 +36,7 @@ struct utsname
char machine[9]; // Name of the hardware type on which the system is running.
};
LIB_API int uname(struct utsname*);
int uname(struct utsname*);
#endif // #ifndef INCLUDED_WUTSNAME

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -350,8 +350,6 @@ C++ classes. this way is more reliable/documented, but has several drawbacks:
*/
#ifdef LIB_STATIC_LINK
#include "lib/utf8.h"
EXTERN_C int wmainCRTStartup();
@ -390,5 +388,3 @@ EXTERN_C int wseh_EntryPoint()
#endif
return CallStartupWithinTryBlock();
}
#endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -372,31 +372,11 @@ Status wutil_SetPrivilege(const wchar_t* privilege, bool enable)
//-----------------------------------------------------------------------------
// module handle
#ifndef LIB_STATIC_LINK
#include "lib/sysdep/os/win/wdll_main.h"
HMODULE wutil_LibModuleHandle()
{
HMODULE hModule;
const DWORD flags = GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS|GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT;
const BOOL ok = GetModuleHandleEx(flags, (LPCWSTR)&wutil_LibModuleHandle, &hModule);
// (avoid ENSURE etc. because we're called from debug_DisplayError)
wdbg_assert(ok);
return hModule;
}
#else
HMODULE wutil_LibModuleHandle()
{
return GetModuleHandle(0);
}
#endif
//-----------------------------------------------------------------------------
// find main window

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -181,7 +181,7 @@ private:
//-----------------------------------------------------------------------------
LIB_API Status wutil_SetPrivilege(const wchar_t* privilege, bool enable);
Status wutil_SetPrivilege(const wchar_t* privilege, bool enable);
/**
* @return module handle of lib code (that of the main EXE if

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -41,7 +41,7 @@ const size_t WVERSION_10 = 0x0604;
/**
* @return one of the above WVERSION* values
**/
LIB_API size_t wversion_Number();
size_t wversion_Number();
/**
* @return short textual representation of the version

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -54,7 +54,7 @@ static const size_t os_cpu_MaxProcessors = sizeof(uintptr_t)*CHAR_BIT;
* this process.
* its population count is by definition equal to os_cpu_NumProcessors().
**/
LIB_API uintptr_t os_cpu_ProcessorMask();
uintptr_t os_cpu_ProcessorMask();
/**
* @return the number of processors available to this process.
@ -62,7 +62,7 @@ LIB_API uintptr_t os_cpu_ProcessorMask();
* note: this function is necessary because POSIX sysconf _SC_NPROCESSORS_CONF
* is not suppored on MacOSX, else we would use that.
**/
LIB_API size_t os_cpu_NumProcessors();
size_t os_cpu_NumProcessors();
//-----------------------------------------------------------------------------
@ -72,36 +72,36 @@ LIB_API size_t os_cpu_NumProcessors();
* @return a rough estimate of the CPU clock frequency.
* this is usually accurate to a few MHz and is faster than measurement loops.
**/
LIB_API double os_cpu_ClockFrequency();
double os_cpu_ClockFrequency();
/**
* @return the size [bytes] of a MMU page (4096 on most IA-32 systems)
**/
LIB_API size_t os_cpu_PageSize();
size_t os_cpu_PageSize();
/**
* @return the size [bytes] of a large MMU page (4 MiB on most IA-32 systems)
* or zero if they are not supported.
**/
LIB_API size_t os_cpu_LargePageSize();
size_t os_cpu_LargePageSize();
/**
* @return the size [MB] of physical memory as reported by the OS;
* no caching/validation is performed.
**/
LIB_API size_t os_cpu_QueryMemorySize();
size_t os_cpu_QueryMemorySize();
/**
* @return the size [MB] of physical memory; caches the result of
* os_cpu_QueryMemorySize and overrides it with a more exact value
* if SMBIOS information is available.
**/
LIB_API size_t os_cpu_MemorySize();
size_t os_cpu_MemorySize();
/**
* @return the current amount [MB] of available memory.
**/
LIB_API size_t os_cpu_MemoryAvailable();
size_t os_cpu_MemoryAvailable();
//-----------------------------------------------------------------------------
@ -114,7 +114,7 @@ LIB_API size_t os_cpu_MemoryAvailable();
* (bit index i corresponds to processor i)
* @return the previous mask
**/
LIB_API uintptr_t os_cpu_SetThreadAffinityMask(uintptr_t processorMask);
uintptr_t os_cpu_SetThreadAffinityMask(uintptr_t processorMask);
class os_cpu_ScopedSetThreadAffinityMask
{
@ -148,6 +148,6 @@ typedef void (*OsCpuCallback)(size_t processor, uintptr_t cbData);
* order of processor ID.
* fails if process affinity prevents running on all processors.
**/
LIB_API Status os_cpu_CallByEachCPU(OsCpuCallback cb, uintptr_t cbData);
Status os_cpu_CallByEachCPU(OsCpuCallback cb, uintptr_t cbData);
#endif // #ifndef INCLUDED_OS_CPU

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -27,7 +27,7 @@
#ifndef INCLUDED_RTL
#define INCLUDED_RTL
LIB_API void* rtl_AllocateAligned(size_t size, size_t alignment);
LIB_API void rtl_FreeAligned(void* alignedPointer);
void* rtl_AllocateAligned(size_t size, size_t alignment);
void rtl_FreeAligned(void* alignedPointer);
#endif // #ifndef INCLUDED_RTL

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2018 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -1219,13 +1219,13 @@ struct Structures
* thread-safe; return value should be cached (if possible) to avoid an
* atomic comparison.
**/
LIB_API const Structures* GetStructures();
const Structures* GetStructures();
/**
* @return a string describing all structures (omitting fields with
* meaningless or dummy values).
**/
LIB_API std::string StringizeStructures(const Structures*);
std::string StringizeStructures(const Structures*);
} // namespace SMBIOS

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -72,15 +72,14 @@ extern ErrorReactionInternal sys_display_error(const wchar_t* text, size_t flags
* (if so, it is safe to use debug_break; otherwise, that would
* raise an exception)
**/
LIB_API bool sys_IsDebuggerPresent();
bool sys_IsDebuggerPresent();
/**
* @return a wide string conversion of the platform's encoding of main's argv.
*
* (NB: wseh.cpp defines a wmain that converts argv to UTF-8 and calls main(),
* but only if LIB_STATIC_LINK)
* (NB: wseh.cpp defines a wmain that converts argv to UTF-8 and calls main())
**/
LIB_API std::wstring sys_WideFromArgv(const char* argv_i);
std::wstring sys_WideFromArgv(const char* argv_i);
/**
* describe the current OS error state.
@ -111,7 +110,7 @@ Status sys_get_module_filename(void* addr, OsPath& pathname);
*
* this is useful for determining installation directory, e.g. for VFS.
**/
LIB_API OsPath sys_ExecutablePathname();
OsPath sys_ExecutablePathname();
/**
* Get the current user's login name.
@ -164,7 +163,7 @@ extern size_t sys_max_sector_size();
* this should only be used with small numbers of bytes, to avoid
* hogging the system's entropy.
**/
LIB_API Status sys_generate_random_bytes(u8* buf, size_t count);
Status sys_generate_random_bytes(u8* buf, size_t count);
/**
* get the proxy address for accessing the given HTTP URL.
@ -173,12 +172,12 @@ LIB_API Status sys_generate_random_bytes(u8* buf, size_t count);
*
* @return INFO::OK on success; INFO::SKIPPED if no proxy found.
**/
LIB_API Status sys_get_proxy_config(const std::wstring& url, std::wstring& proxy);
Status sys_get_proxy_config(const std::wstring& url, std::wstring& proxy);
/**
* open a file like with fopen (but taking an OsPath argument).
*/
LIB_API FILE* sys_OpenFile(const OsPath& pathname, const char* mode);
FILE* sys_OpenFile(const OsPath& pathname, const char* mode);
/**
* directory separation character

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -63,7 +63,7 @@ enum PageType
* (an error dialog will also be raised).
* must be freed via ReleaseAddressSpace.
**/
LIB_API void* ReserveAddressSpace(size_t size, size_t commitSize = g_LargePageSize, PageType pageType = kDefault, int prot = PROT_READ|PROT_WRITE);
void* ReserveAddressSpace(size_t size, size_t commitSize = g_LargePageSize, PageType pageType = kDefault, int prot = PROT_READ|PROT_WRITE);
/**
* release address space and decommit any memory.
@ -72,7 +72,7 @@ LIB_API void* ReserveAddressSpace(size_t size, size_t commitSize = g_LargePageSi
* @param size is required by the POSIX implementation and
* ignored on Windows.
**/
LIB_API void ReleaseAddressSpace(void* p, size_t size = 0);
void ReleaseAddressSpace(void* p, size_t size = 0);
/**
@ -90,14 +90,14 @@ LIB_API void ReleaseAddressSpace(void* p, size_t size = 0);
*
* (this is surprisingly slow in XP, possibly due to PFN lock contention)
**/
LIB_API bool Commit(uintptr_t address, size_t size, PageType pageType = kDefault, int prot = PROT_READ|PROT_WRITE);
bool Commit(uintptr_t address, size_t size, PageType pageType = kDefault, int prot = PROT_READ|PROT_WRITE);
/**
* unmap physical memory.
*
* @return whether the operation succeeded.
**/
LIB_API bool Decommit(uintptr_t address, size_t size);
bool Decommit(uintptr_t address, size_t size);
/**
@ -108,7 +108,7 @@ LIB_API bool Decommit(uintptr_t address, size_t size);
* @param prot memory protection flags: PROT_NONE or a combination of
* PROT_READ, PROT_WRITE, PROT_EXEC.
**/
LIB_API bool Protect(uintptr_t address, size_t size, int prot);
bool Protect(uintptr_t address, size_t size, int prot);
/**
@ -119,7 +119,7 @@ LIB_API bool Protect(uintptr_t address, size_t size, int prot);
* @return zero-initialized memory aligned to the respective
* page size.
**/
LIB_API void* Allocate(size_t size, PageType pageType = kDefault, int prot = PROT_READ|PROT_WRITE);
void* Allocate(size_t size, PageType pageType = kDefault, int prot = PROT_READ|PROT_WRITE);
/**
* decommit memory and release address space.
@ -131,23 +131,23 @@ LIB_API void* Allocate(size_t size, PageType pageType = kDefault, int prot = PRO
* (this differs from ReleaseAddressSpace, which must account for
* extra padding/alignment to largePageSize.)
**/
LIB_API void Free(void* p, size_t size = 0);
void Free(void* p, size_t size = 0);
/**
* install a handler that attempts to commit memory whenever a
* read/write page fault is encountered. thread-safe.
**/
LIB_API void BeginOnDemandCommits();
void BeginOnDemandCommits();
/**
* decrements the reference count begun by BeginOnDemandCommit and
* removes the page fault handler when it reaches 0. thread-safe.
**/
LIB_API void EndOnDemandCommits();
void EndOnDemandCommits();
LIB_API void DumpStatistics();
void DumpStatistics();
} // namespace vm

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -41,17 +41,17 @@
/**
* timer_Time will subsequently return values relative to the current time.
**/
LIB_API void timer_Init();
void timer_Init();
/**
* @return high resolution (> 1 us) timestamp [s].
**/
LIB_API double timer_Time();
double timer_Time();
/**
* @return resolution [s] of the timer.
**/
LIB_API double timer_Resolution();
double timer_Resolution();
// (allow using XADD (faster than CMPXCHG) in 64-bit builds without casting)
@ -65,8 +65,8 @@ typedef i64 Cycles;
* internal helper functions for returning an easily readable
* string (i.e. re-scaled to appropriate units)
**/
LIB_API std::string StringForSeconds(double seconds);
LIB_API std::string StringForCycles(Cycles cycles);
std::string StringForSeconds(double seconds);
std::string StringForCycles(Cycles cycles);
//-----------------------------------------------------------------------------
@ -299,7 +299,7 @@ struct TimerClient
* - free() is not needed nor possible.
* - description must remain valid until exit; a string literal is safest.
**/
LIB_API TimerClient* timer_AddClient(TimerClient* tc, const wchar_t* description);
TimerClient* timer_AddClient(TimerClient* tc, const wchar_t* description);
/**
* "allocate" a new TimerClient that will keep track of the total time
@ -343,7 +343,7 @@ struct BillingPolicy_Atomic
* display all clients' totals; does not reset them.
* typically called at exit.
**/
LIB_API void timer_DisplayClientTotals();
void timer_DisplayClientTotals();
/// used by TIMER_ACCRUE

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -44,11 +44,11 @@ namespace ERR
* otherwise, the function raises a warning dialog for every
* error/warning.
**/
LIB_API std::wstring wstring_from_utf8(const std::string& s, Status* err = 0);
std::wstring wstring_from_utf8(const std::string& s, Status* err = 0);
/**
* opposite of wstring_from_utf8
**/
LIB_API std::string utf8_from_wstring(const std::wstring& s, Status* err = 0);
std::string utf8_from_wstring(const std::wstring& s, Status* err = 0);
#endif // #ifndef INCLUDED_UTF8