{"action":"created","issue":{"url":"https://api.github.com/repos/doitsujin/dxvk/issues/268","repository_url":"https://api.github.com/repos/doitsujin/dxvk","labels_url":"https://api.github.com/repos/doitsujin/dxvk/issues/268/labels{/name}","comments_url":"https://api.github.com/repos/doitsujin/dxvk/issues/268/comments","events_url":"https://api.github.com/repos/doitsujin/dxvk/issues/268/events","html_url":"https://github.com/doitsujin/dxvk/pull/268","id":313146199,"node_id":"MDExOlB1bGxSZXF1ZXN0MTgwNzcwNzc0","number":268,"title":"[build] Experimental winegcc support","user":{"login":"pchome","id":10661854,"node_id":"MDQ6VXNlcjEwNjYxODU0","avatar_url":"https://avatars0.githubusercontent.com/u/10661854?v=4","gravatar_id":"","url":"https://api.github.com/users/pchome","html_url":"https://github.com/pchome","followers_url":"https://api.github.com/users/pchome/followers","following_url":"https://api.github.com/users/pchome/following{/other_user}","gists_url":"https://api.github.com/users/pchome/gists{/gist_id}","starred_url":"https://api.github.com/users/pchome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pchome/subscriptions","organizations_url":"https://api.github.com/users/pchome/orgs","repos_url":"https://api.github.com/users/pchome/repos","events_url":"https://api.github.com/users/pchome/events{/privacy}","received_events_url":"https://api.github.com/users/pchome/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":16,"created_at":"2018-04-11T01:52:33Z","updated_at":"2018-06-01T23:20:36Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/doitsujin/dxvk/pulls/268","html_url":"https://github.com/doitsujin/dxvk/pull/268","diff_url":"https://github.com/doitsujin/dxvk/pull/268.diff","patch_url":"https://github.com/doitsujin/dxvk/pull/268.patch"},"body":"* Allow DXVK to be built as WINE builtin dlls (#60)\r\n* .spec and .def files not provided by WINE are placed\r\n  into ./linux/ directory in src root\r\n* wine-staging dll-redirects support added as an option\r\n* An attempt to fix wide-strings problem, but need to be reviewed\r\n* Unstable, can either run or not\r\n* Performance comparable to native .dlls, so I'm asking people to\r\n  not use this, if you don't know why you need this"},"comment":{"url":"https://api.github.com/repos/doitsujin/dxvk/issues/comments/394033707","html_url":"https://github.com/doitsujin/dxvk/pull/268#issuecomment-394033707","issue_url":"https://api.github.com/repos/doitsujin/dxvk/issues/268","id":394033707,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NDAzMzcwNw==","user":{"login":"pchome","id":10661854,"node_id":"MDQ6VXNlcjEwNjYxODU0","avatar_url":"https://avatars0.githubusercontent.com/u/10661854?v=4","gravatar_id":"","url":"https://api.github.com/users/pchome","html_url":"https://github.com/pchome","followers_url":"https://api.github.com/users/pchome/followers","following_url":"https://api.github.com/users/pchome/following{/other_user}","gists_url":"https://api.github.com/users/pchome/gists{/gist_id}","starred_url":"https://api.github.com/users/pchome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pchome/subscriptions","organizations_url":"https://api.github.com/users/pchome/orgs","repos_url":"https://api.github.com/users/pchome/repos","events_url":"https://api.github.com/users/pchome/events{/privacy}","received_events_url":"https://api.github.com/users/pchome/received_events","type":"User","site_admin":false},"created_at":"2018-06-01T23:20:36Z","updated_at":"2018-06-01T23:20:36Z","author_association":"CONTRIBUTOR","body":"I have spent a bit of time for debugging string conversion and now I see what happens.\r\n* WINE using `-fshort-wchar` compiler option to use 2 byte `wchar_t` (unsigned short), but system (linux) `wchar_t` is 4 byte.\r\nThis causes `std::wstring_convert<std::codecvt_utf8<wchar_t>>().to_bytes(ws);` conversion problem and undefined behaviour for other `std::wstring` manipulation since system libraries (libstdc++/libgcc) used.\r\n* `winegcc` do not support static linking with `-static`\r\n  >  Static  linking  is  not currently supported against Wine DLLs. As a result, the -static, --static, and -Wl,-static options will generate an error.\r\nso building/using statics like MinGW does is not an option.\r\n* `-fno-short-wchar` compiler option partially solves this problem, but additional conversion from 32 bit `wchar_t` (string literals) to `WCHAR` (unsigned short) required [here](https://github.com/doitsujin/dxvk/blob/9ff17b03f24c7a5d0a1825214f1697e5f6e48f1e/src/util/util_env.cpp#L7).\r\n\r\n**If anyone want to help** and can properly implement such conversions - **URW**.\r\n\r\nHere is somehow working example from my testing:\r\n```c++\r\n  std::string getEnvVar(const wchar_t* name) {\r\n    std::string mb_name = std::wstring_convert<std::codecvt_utf8<wchar_t>>{}.to_bytes(name);\r\n\r\n    DWORD slen = MultiByteToWideChar(CP_UNIXCP, 0, mb_name.c_str(), -1, nullptr, 0);\r\n    WCHAR ret[slen];\r\n    MultiByteToWideChar(CP_UNIXCP, 0, mb_name.c_str(), -1, ret, slen);\r\n\r\n    DWORD len = ::GetEnvironmentVariableW(ret, nullptr, 0);\r\n...\r\n```\r\n\r\n_FYI: #392, using e.g. `wine` (/usr/lib/wine-staging-3.9/bin/wine64) as \"executable\" parameter for `gdb` compatible debugger lets `gdb` automatically determine system type an load symbols from `*.so` shared libraries._"}}
{"actor":{"display_login":"pchome"}}