Skip to content
Discussion options

You must be logged in to vote

The problem is in the following snippet:

import {
    xmlC14NDocDumpMemory,
} from './libxml2.mjs';
import type { XmlDocument } from './document.mjs';
import moduleLoader from './libxml2raw.mjs';

const libxml2 = await moduleLoader();
export function canonicalize(document: XmlDocument): string {
    const docTxtPtr = libxml2._malloc(4);
    const result = xmlC14NDocDumpMemory(document._ptr, 0, 0, 0, 0, docTxtPtr);

moduleLoader is a function that creates a WASM module. libxml2.mts calls moduleLoader to create one, and exports its functions. Let's call this instance of libxml2 global.
In your code, you created a new instance, by calling moduleLoader, and let's call this instance local.

So i…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@shunkica
Comment options

@jameslan
Comment options

@shunkica
Comment options

Answer selected by shunkica
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants