Skip to content

Instantly share code, notes, and snippets.

@bjfish
Created March 5, 2019 04:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjfish/32c9a120503200663532721d961011db to your computer and use it in GitHub Desktop.
Save bjfish/32c9a120503200663532721d961011db to your computer and use it in GitHub Desktop.
void print_str(wasmer_instance_context_t *ctx, int32_t ptr, int32_t len)
{
print_str_called = true;
wasmer_memory_t *memory = wasmer_instance_context_memory(ctx, 0);
uint32_t mem_len = wasmer_memory_length(memory);
uint8_t *mem_bytes = wasmer_memory_data(memory);
printf("%.*s", len, mem_bytes + ptr);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment