Reputation: 61378
I compile my Android NDK library with -fshort-wchar
. I know the RTL assumes 4-byte wchar_t, I know what I'm doing, the library works. However, on every build linker gives me the following warning for every object file:
ld.exe: warning: MyFile.o uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
When I provide
LOCAL_LDLIBS := --no-wchar-size-warning
This gives me an "unrecognized option" error.
Upvotes: 2
Views: 5059
Reputation: 57163
Have you seen this? The post explains that the --no-wchar-size-warning
option will make the linker treat the mismatch as a warning, not an error. As in the enum case, the authors choose to display the message anyway.
You don't see the effect of setting this flag in your project because as detailed elsewhere, using -fshort-wchar
automatically adds -Wl,--no-wchar-size-warning
.
Upvotes: 2
Reputation: 5613
Adding APP_LDFLAGS += -Wl,--no-wchar-size-warning
(to Application.mk
) works fine for me on NDKs at least as early as r7.
I assume it would work just the same as:
LOCAL_LDLIBS := -Wl,--no-wchar-size-warning
Upvotes: 4