Hello.
I tried to create my own extension. It worked fine with passing and returning numbers in expressions. But how to do this with strings? I thought p1 was the memory address pointing to the string. But my code outputs nothing (empty string). What do I do wrong?
Code:
short expressionsInfos[]=
{
IDMN_EXPRESSION, M_EXPRESSION, EXP_EXPRESSION, EXPFLAG_STRING, 1, EXPPARAM_STRING, 0,
//Note in the following. If you are returning a string, you set the EXPFLAG_STRING.
IDMN_EXPRESSION2, M_EXPRESSION2, EXP_EXPRESSION2, EXPFLAG_STRING, 1, EXPPARAM_STRING, 0,
//Note in the following. If you are returning a float, you set the EXPFLAG_DOUBLE
IDMN_EXPRESSION3, M_EXPRESSION3, EXP_EXPRESSION3, EXPFLAG_DOUBLE, 1, EXPPARAM_LONG, 0,
};
long WINAPI DLLExport Expression2(LPRDATA rdPtr,long param1)
{
long p1 = CNC_GetFirstExpressionParameter(rdPtr, param1, TYPE_STRING);
std::string str(*(std::string*)p1);
str = "changed text";
long addr = (long)&str;
rdPtr->rHo.hoFlags |= HOF_STRING;
return addr;
}