Skip to content

read_wasm_binary_to_buffer() function is not available #4263

@kr-t

Description

@kr-t

Hello Everyone,

In https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/doc/embed_wamr.md example, there are mention of following API:

/* read WASM file into a memory buffer */
  buffer = read_wasm_binary_to_buffer(…, &size);

Nevertheless, this function does not exists in the code, therefore making the documentation incomplete/misleading. I would recommend one of the following solutions:

  1. Replace read_wasm_binary_to_buffer() to bh_read_file_to_buffer() in the documentation. POSIX example in product-mini uses it and it serves exactly the same purpose, as read_wasm_binary_to_buffer() suppose to be serving. In this case I would also recommend including build steps for this file as in this issue: bh_read_file.h isn't in any of the include paths. #4221
  2. Implement the read_wasm_binary_to_buffer() function in the appropriate file. This is a simple function and even an implementation is already available under the similar bh_read_file_to_buffer() function.
  3. Note in the documentation, that read_wasm_binary_to_buffer() is not available and user shall write it by themselves. Examples of implementation can be included (few implementations can be found via Google).

Let me know what do you think is the appropriate fix for this. I would gladly help with the PR, if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions