Hello, I'm having a bit of trouble and hope someone can explain what I'm doing wrong.
I have a main application class registered as asOBJ_REF | asOBJ_NOCOUNT. It returns handles to various other application objects that are similarly registered. I've registered the built-in std::string with RegisterStdString().
If I print a static const string using a registered print function it's passed okay: print("static string");
If I print a string variable it passes the contents over correctly:
string msg = “string variable”;
print(msg);
However, when I pass the same variable to a member function of an application singleton it appears the string structure is (mostly) right but there are no characters in the passed string.
oEngine->RegisterObjectMethod("app", "void host_url(const string& in)", asMETHOD(_this_t, set_host_url), asCALL_THISCALL);
---
string sURL = “some url”;
app.host_url(sURL);
---
The host_url member of the application gets invoked but the passed string is empty. However, If I invoke it with a static const string it works:
---
app.host_url("http://some url");
---
When passing the string constant the characters appear correctly instantiated in the string parameter but not when passing a script string object. The characters appear missing from the string buffer though the size appears correct.
Please advise.
Many thanks.