///
import { ExecCore } from '../exec';
declare class DynamicLoader {
core: ExecCore;
dylibTable?: DynamicLibrary.Table;
constructor(core: ExecCore);
preload(path: string, uri: string, reloc?: DynamicLibrary.Relocations): Promise;
get import(): {};
get extlib(): {};
dlopen(path: i32, flags: i32): number;
dlsym(handle: i32, symbol: i32): number;
dlclose(handle: i32): void;
dlerror_get(pbuf: i32): number;
allocateFunc(func: Function): number;
allocateDelegate(func: Function): number;
userGetCString(addr: i32): Buffer;
userCStringMalloc(s: string, pbuf: i32): number;
}
declare namespace DynamicLibrary {
class Table {
def: Map;
ref: Map;
}
class Def {
module: WebAssembly.Module;
reloc: Relocations;
metadata: {
path?: string;
uri?: string;
};
stackSize: number; /** @todo */
memBlocks: number; /** @todo */
tblSize: number; /** @todo */
constructor(module: WebAssembly.Module, reloc?: Relocations, metadata?: {
path?: string;
uri?: string;
});
instantiate(core: ExecCore): any;
relocTable(module: WebAssembly.Module, main: WebAssembly.Instance, std: {
[name: string]: any;
}): {};
globals(module: WebAssembly.Module, main: WebAssembly.Instance): Globals;
globalsInit(instance: WebAssembly.Instance, mem_base: number, globals: GlobalsModule): void;
/**
* [internal] creates a table of self-referenced globals.
* Specific to Emscripten.
*/
emglobals(module: WebAssembly.Module, mem_base: number, main: WebAssembly.Instance, instance: () => WebAssembly.Instance): {};
_mkglobal(initial?: i32): WebAssembly.Global;
}
type Ref = {
def: Def;
instance?: WebAssembly.Instance;
};
type Relocations = {
js?: {
[sym: string]: Function;
};
};
}
declare type i32 = number;
declare type GlobalsModule = {
[name: string]: WebAssembly.Global;
};
declare type Globals = {
[module: string]: GlobalsModule;
};
export { DynamicLoader, DynamicLibrary };