Skip to content

Commit

Permalink
fbc/emscripten: sizeof(wchar_t) is 4, not 2. wstring was broken.
Browse files Browse the repository at this point in the history
JS strings are 16-bit (UCS2), which is where the confusion comes from.

In practice depending on exact use, using wstrings could seem to work but get
corrupted at the ends.
  • Loading branch information
rversteegen committed Jun 25, 2023
1 parent 936c086 commit f1690c6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.txt
Expand Up @@ -8,6 +8,7 @@ Version 1.10.1
[fixed]
- sf.net #982: Array descriptors emitted incorrectly in gcc backend
- emscripten: fbc created faulty static libraries (it called ar instead of emar)
- fbc: emscripten: wstring was broken because sizeof(wstring) was 2 rather than 4


Version 1.10.0
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/fb.bas
Expand Up @@ -217,7 +217,7 @@ dim shared as FBTARGET targetinfo(0 to FB_COMPTARGETS-1) = _
), _
( _
@"js", _
FB_DATATYPE_USHORT, _ '' wchar
FB_DATATYPE_ULONG, _ '' wchar
FB_FUNCMODE_CDECL, _
FB_FUNCMODE_STDCALL_MS, _
0 or FB_TARGETOPT_UNIX _
Expand Down

0 comments on commit f1690c6

Please sign in to comment.