I believe that's on the embind todo list.  (Since pointers don't have
unambiguous semantics, the bindings would need explicit pointer policies,
and that work hasn't been done yet.)

However, there's a workaround!  You can do something like:

#include <Library.h>
// assume Library.h declares: void libraryFunction(const char*);

static void libraryFunctionWrapper(const std::string& s) {
    libraryFunction(s.c_str());
}

EMSCRIPTEN_BINDINGS(Library) {
    function("libraryFunction", &libraryFunctionWrapper);
}



On Tue, Aug 26, 2014 at 1:28 PM, Lóránt Pintér <[email protected]>
wrote:

>  Hi,
>
> Is it possible in embind to treat char* as a JS string? If not, how can I
> call a C function with a char* parameter from JS?
>
> Thanks
> —
> Lóránt
>
> --
> 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.
>



-- 
Chad Austin
Technical Director, IMVU
http://engineering.imvu.com <http://www.imvu.com/members/Chad/>
http://chadaustin.me

-- 
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.

Reply via email to