Added support for wide characters when creating named resources in operating systems with wide-char APIs (at this time, Windows).

Fixes #93 and fixes #134.
This commit is contained in:
Ion Gaztañaga
2021-01-31 00:27:15 +01:00
parent 8f63c6054c
commit 140b50efb3
59 changed files with 2591 additions and 405 deletions

View File

@@ -21,6 +21,9 @@ using namespace boost::interprocess;
static const std::size_t ShmSize = 1000;
static const char * ShmName = test::get_process_id_name();
#ifdef BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES
static const wchar_t * ShmNameW = test::get_process_id_wname();
#endif
struct eraser
{
@@ -53,12 +56,37 @@ class shared_memory_creation_test_wrapper
{}
};
#ifdef BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES
class shared_memory_creation_test_wrapper_w
: public eraser
, public shared_memory
{
public:
shared_memory_creation_test_wrapper_w(create_only_t)
: shared_memory(create_only, ShmNameW, ShmSize, read_write, 0, permissions())
{}
shared_memory_creation_test_wrapper_w(open_only_t)
: shared_memory(open_only, ShmNameW, read_write, 0)
{}
shared_memory_creation_test_wrapper_w(open_or_create_t)
: shared_memory(open_or_create, ShmNameW, ShmSize, read_write, 0, permissions())
{}
};
#endif
int main ()
{
try{
shared_memory_object::remove(ShmName);
test::test_named_creation<shared_memory_creation_test_wrapper>();
#ifdef BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES
test::test_named_creation<shared_memory_creation_test_wrapper_w>();
#endif
//Create and get name, size and address
{