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

Fix static-lib unit bugs #231

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/lib/mormot.lib.quickjs.pas
Original file line number Diff line number Diff line change
Expand Up @@ -3623,7 +3623,9 @@ procedure TJSContext.FromVariant(const val: variant; out result: JSValue);


initialization
{$IfNDef NOLIBCSTATIC}
SetLibcNumericLocale; // required for quickjs parsing :(
{$EndIf}
assert(SizeOf(JSValueRaw) = SizeOf(JSValue));
{$ifdef JS_ANY_NAN_BOXING}
assert(SizeOf(JSValueRaw) = SizeOf(double));
Expand Down
8 changes: 6 additions & 2 deletions src/lib/mormot.lib.static.pas
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,9 @@ function libc_strchr(s: Pointer; c: Integer): Pointer; cdecl;
external _CLIB name 'strchr';
function libc_strtod(value: PAnsiChar; endPtr: PPAnsiChar): Double; cdecl;
external _CLIB name 'strtod';
function libc_write(handle: Integer; buf: Pointer; len: LongWord): Integer; cdecl;
function libc_fileno(f: Pointer): Integer; cdecl;
external _CLIB name '_fileno';
function libc_write(handle: Integer; buf: Pointer; len: LongWord): Integer; cdecl;
external _CLIB name '_write';
procedure libc_qsort(baseP: PByte; NElem, Width: PtrInt; comparF: qsort_compare_func); cdecl;
external _CLIB name 'qsort';
Expand Down Expand Up @@ -417,7 +419,7 @@ function strrchr(s: PUtf8Char; c: AnsiChar): PUtf8Char; cdecl;
function fwrite(buf: pointer; size, count: PtrInt; f: pointer): integer; cdecl;
{$ifdef FPC} public name _PREFIX + 'fwrite'; {$endif}
begin
result := libc_write(PtrInt(f), buf, size * count) div size;
result := libc_write(libc_fileno(f), buf, size * count) div size;
end;

{$ifdef CPUX86}
Expand Down Expand Up @@ -2112,6 +2114,7 @@ procedure ResetFpuFlags(saved: cardinal);
initialization
{$ifdef FPC}
{$ifdef OSWINDOWS}
{$IfNDef NOLIBCSTATIC}
// manual fill of our raw mingw import table
beginthreadex := @libc_beginthreadex;
endthreadex := @libc_endthreadex;
Expand All @@ -2120,6 +2123,7 @@ initialization
{$else}
imp_localtime64 := @localtime64;
{$endif CPU32}
{$EndIf}
{$endif OSWINDOWS}
{$ifdef OSLINUXX64}
_pthread_load;
Expand Down