The problem is most likely C++ name mangling. If you declare the function
with C linkage (i.e. with extern "C" { unsigned int fibonacci(unsigned int
n); } ) then it should be non-mangled. Of course that will prevent you from
overloading it, but it will make bindings easier.On Sun, Sep 3, 2017 at 2:07 AM Maga D. Zandaqo <[email protected]> wrote: > Hi, > > Is there any way to expose simple C++ functions with WebIDL without > wrapping them into classes? E.g. I have a function in say fibonacci.cpp: > > unsigned int fibonacci(unsigned int n) { > return fib(n, 0, 1); > } > > I tried exposing it in WebIDL as: > callback fibonacci = long (long n); > > But that doesn't seem to work, the resulting module doesn't have a > function called fibonacci on it. > > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
