Skip to content

How to BinaryenCallRef #6718

@gotocoffee1

Description

@gotocoffee1

Hello I am trying to use BinaryenCallRef but its not clear how. Unfortunately there is no example in c-api-kitchen-sink or other docs.
I tried it this way:

  BinaryenAddFunction(mod, "name", BinaryenTypeCreate(nullptr, 0), BinaryenTypeCreate(nullptr, 0), nullptr, 0, BinaryenUnreachable(mod));
  auto exp = BinaryenRefFunc(mod, "name", BinaryenTypeFuncref());
  exp      = BinaryenCallRef(mod, exp, nullptr, 0, BinaryenTypeFuncref(), false);

  BinaryenAddFunction(mod, "name2", BinaryenTypeCreate(nullptr, 0), BinaryenTypeCreate(nullptr, 0), nullptr, 0, exp);
   

But the end boss is always this assert,

Any tips how I should use it or should I go back to call_indirect for now?

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