mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 04:09:11 +02:00
* forgot to commit
This commit is contained in:
parent
736fc12e55
commit
9e9153b2d3
45
packages/wasm-utils/src/wasm.memutils.pas
Normal file
45
packages/wasm-utils/src/wasm.memutils.pas
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
{
|
||||||
|
This file is part of the Free Component Library
|
||||||
|
|
||||||
|
Webassembly memory utils.
|
||||||
|
Copyright (c) 2025 by Michael Van Canneyt michael@freepascal.org
|
||||||
|
|
||||||
|
See the file COPYING.FPC, included in this distribution,
|
||||||
|
for details about the copyright.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
**********************************************************************}
|
||||||
|
unit wasm.memutils;
|
||||||
|
|
||||||
|
{$mode ObjFPC}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
Type
|
||||||
|
TWasmGrowMemoryEvent = procedure(aPages : longint) of object;
|
||||||
|
|
||||||
|
var
|
||||||
|
MemGrowNotifyCallBack : TWasmGrowMemoryCallBack;
|
||||||
|
MemGrowNotifyEvent : TWasmGrowMemoryEvent;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
procedure __wasm_memory_grow_notification(aPages : Longint); external 'wasmmem' name 'wasm_memory_grow_notification' ;
|
||||||
|
|
||||||
|
procedure MemNotify(aPages : longint);
|
||||||
|
|
||||||
|
begin
|
||||||
|
__wasm_memory_grow_notification(aPages);
|
||||||
|
if assigned(MemGrowNotifyCallBack) then
|
||||||
|
MemGrowNotifyCallBack(aPages);
|
||||||
|
if assigned(MemGrowNotifyEvent) then
|
||||||
|
MemGrowNotifyEvent(aPages);
|
||||||
|
end;
|
||||||
|
|
||||||
|
initialization
|
||||||
|
WasmGrowMemoryCallback:=@MemNotify;
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user