2007-07-0504:53 AM - last edited on 2023-08-0710:26 AM by Doreena Deng
I try to use API Dev 11 to develop my Add-on. And I found that GSRoot Document (come with API Dev 11) is out-of-date. I can not find any method (fuction) to work with GS::uchar_t ( such as GS::ucscpy ...). So I must try some code in an example. I can use some example-code to develop Add-on that can change 'realValue' parameter of my Object. But when I try to change 'uStrValue' parameter using code like ... CHCopyC ("Dir", chgParam.name); GS::UniString tmpUStr ("Left"); GS::ucscpy (chgParam.uStrValue, tmpUStr.ToUStr()); My ArchiCAD will be crash ! How can I solve this problem and how can I find document about GS::uchar_t ? Thank you Hemmachart R.
Hemmachart wrote: GS::ucscpy (chgParam.uStrValue, tmpUStr.ToUStr());
My ArchiCAD will be crash !
'uStrValue' is a pointer in 'API_ChangeParamType'. You can't simply copy characters to the address it points to without allocating space for the string. You are probably writing to a spurious/random/null location, which explains the crash. Try setting 'uStrValue' to a pointer to the string already allocated in 'tmpUStr'.