Help exposing a C++ function with argument type std::string into .idl file - Ammo.js

16 views
Skip to first unread message

Evan Darcy

unread,
Jun 1, 2019, 11:27:47 AM6/1/19
to emscripten-discuss
I am trying to expose this c++ function, it takes an argument of type std::string

 int loadURDF(const std::string &fileName, const struct b3RobotSimulatorLoadUrdfFileArgs &args = b3RobotSimulatorLoadUrdfFileArgs());

Here is what I have in my .idl file, on the last line you will see the declaration.

interface b3RobotSimulatorLoadUrdfFileArgs {
 
void b3RobotSimulatorLoadUrdfFileArgs();
};


interface b3RobotSimulatorClientAPI_NoDirect {
 
void b3RobotSimulatorClientAPI_NoDirect();
 
[Const] long getAPIVersion();
 
void loadURDF([Const, Ref] DOMString filename, [Const, Ref] b3RobotSimulatorLoadUrdfFileArgs args);
};


I am getting the following error:

glue.cpp:5083:18: error: reference to type 'const std::string' (aka 'const basic_string<char, char_traits<char>, allocator<char> >') could not bind to an lvalue of type 'const char'


I think I need a way to convert std::string to const char but I am really lost on how to do that, I couldn't find any solutions on Google...

If anyone can show me how to resolve this issue, it would be much appreciated!

Thanks!


Reply all
Reply to author
Forward
0 new messages