export interface KdlModule {
  ccall: (
    ident: string,
    returnType: string | null,
    argTypes: Array<string | null>,
    args: unknown[]
  ) => unknown;
  cwrap: (
    ident: string,
    returnType: string | null,
    argTypes: Array<string | null>
  ) => (...args: unknown[]) => unknown;
  UTF8ToString: (ptr: number) => string;
  stringToUTF8: (value: string, outPtr: number, maxBytesToWrite: number) => void;
  lengthBytesUTF8: (value: string) => number;
  _malloc: (size: number) => number;
  _free: (ptr: number) => void;
}

export interface KdlModuleFactoryOptions {
  locateFile?: (path: string, prefix: string) => string;
  print?: (text: string) => void;
  printErr?: (text: string) => void;
}

export default function createKdlModule(options?: KdlModuleFactoryOptions): Promise<KdlModule>;
