b0yediti0nB
Deno4mo ago
2 replies
b0yediti0n

Deno Pointer FFI error, malloc(): invalid size (unsorted)

Some runitime im my software i have the error, some me help to fin the line with error?


        libName = libName.toUpperCase();

        const args = [ ]
        params.forEach(param => {
            switch(typeof param){
                case "string":
                    args.push(this.enc.encode(param + '\0'))
                    break;
                default:
                    args.push(param)
            }
        });       

        const DEFAULT_LENGTH = 2792; // Tem que ser divisivel por 8
        const outPtrs = new ArrayBuffer(8 + DEFAULT_LENGTH); // A soma deve dar um valor sem 0 na casa decimal final?
        const sResposta = new Uint8Array(outPtrs, 8, DEFAULT_LENGTH);
        const esTamanho = new Uint8Array(outPtrs, 0, 8);
        // aloca o valor default para os espaço tamanho do buffer
        const esTamanhoView = new Uint16Array(outPtrs, 0, 4); 
        esTamanhoView[0] = DEFAULT_LENGTH;

        args.push(sResposta)
        args.push(esTamanho)

        type typSymbolFFICall = { symbols : { [Key: string]: CallableFunction } }
        
        const libModule = this?.[libName as keyof controleFiscal] as typSymbolFFICall;
libModule!.symbols[method](...args) == 0

new TextDecoder().decode(sResposta.subarray(0, esTamanhoValue));
Was this page helpful?