Im very new to making C++ addons for node.js
So my Question is: Is there a way for an addon-function to return a String? And if so, How? Further Explaining:
Lets say i have a string called std::string testString in my C++ Source File. When given following JS code:
const myAddon = require('path'); console.log(myAddon.myFunc());
It should output the data testString holds.
Sorry if something isnt understandable, this is my first Question here.
Edit: const char* myChar = "Hello World"; would also be okay. Top Priority is to send any kind of Text.
const char*does work perfectly fine:args.GetReturnValue().Set(String::NewFromUtf8(isolate, myChar).ToLocalChecked());wheremyCharis typeconst char*. Doing this directly with std::string doesnt work ofcourse. But atleast i can now send text to my js file, Thanks!std::string::c_str()to get aconst char *out of astd::string