module( std::string m) : m_(nullptr) {
        // if empty string, leave m_ as nullptr;
        if (m.empty()) return;
        // if there is a \ or / in the string then pass it unmodified
        // otherwise place a .dll extension
        if(m.find('\\') == std::string::npos && m.find('/')==std::string::npos) {
            // add a .dll extension
            m += ".dll";
        }


        auto sz = detail::Windows::MultiByteToWideChar(detail::Windows::cp_utf8, 0, m.c_str(), -1, 0, 0);
        if (sz <= 0) {
            throw error_unable_to_load_library();

        }
        std::vector<wchar_t> wchars(sz);

        detail::Windows::MultiByteToWideChar(detail::Windows::cp_utf8, 0, m.c_str(), -1, &wchars[0], sz);



#ifndef CPPCOMPONENTS_WINRT_APP
        m_ = detail::Windows::LoadLibraryW(&wchars[0]);
#else
        m_ = detail::Windows::LoadPackagedLibrary(&wchars[0],0);
#endif
        if(!m_) {
            throw error_unable_to_load_library();
        }


    }
static FILE* fopen_win(const char* utf8path, const char* perm) {
    if (is_ascii(utf8path)) {
        return fopen(utf8path, perm);
    }

    const char* ptr = utf8path;
    const char* end = utf8path + strlen(utf8path);
    size_t n = 0;
    while (ptr < end) {
        SkUnichar u = SkUTF8_NextUnicharWithError(&ptr, end);
        if (u < 0) {
            return nullptr;  // malformed UTF-8
        }
        n += SkUTF16_FromUnichar(u);
    }
    std::vector<uint16_t> wchars(n + 1);
    uint16_t* out = wchars.data();
    for (const char* ptr = utf8path; ptr < end;) {
        out += SkUTF16_FromUnichar(SkUTF8_NextUnicharWithError(&ptr, end), out);
    }
    SkASSERT(out == &wchars[n]);
    *out = 0; // final null
    wchar_t wperms[4] = {(wchar_t)perm[0], (wchar_t)perm[1], (wchar_t)perm[2], (wchar_t)perm[3]};
    return _wfopen((wchar_t*)wchars.data(), wperms);
}