Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify UNICODE build #50

Merged
merged 4 commits into from
May 6, 2019
Merged

Simplify UNICODE build #50

merged 4 commits into from
May 6, 2019

Conversation

pali
Copy link
Collaborator

@pali pali commented Apr 25, 2019

There are lot of #ifdefs which can be removed by providing one implementation which works for both MultiByte and Unicode builds.

The whole dlfcn.h API works with char* (ANSI) strings. For WINAPI UNICODE
builds it is still possible to call WINAPI ANSI functions with -A suffix.
E.g. LoadLibraryExA() instead of LoadLibraryEx() or FormatMessageA()
instead of FormatMessage().

This simplify whole implementation when compiling with UNICODE support as
there is no need to do conversion from wchar_t to char and vice-versa.
Old version of MSVC does not support snprintf() function and sprintf_s() is
not replacement for C99 snprintf(). As the only usage of snprintf() is to
format void* pointer we can use sprintf() with enough long buffer.
Check return value of FormatMessageA() function and remove copy_string()
function as it is not needed.
@traversaro
Copy link
Collaborator

Hi @pali , thanks for the awesome PR!
I will check it in the next days, sorry for the delay.

@pali
Copy link
Collaborator Author

pali commented May 3, 2019

AppVeyor builds now passed.

@traversaro
Copy link
Collaborator

Thanks a lot for the PR @pali .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants