a を返す ac メソッドがあり、const char *
この関数を specman コードにインポートしました。「e」でさらにいくつかのステートメントを実行した後、文字列の値が壊れています。C空間のポインタを参照しているためだと思います。
C 署名:
const char* myFun(const char* key)
{
static string myVal;
myVal = myDictionary[key];
return myVal.c_str();
}
e:
myFun(key : string) : string is foreign dynamic C routine
使用法:
var str : string;
var str2 : string;
str = myFun("my_test");
outf("%s",str) ---> here it gives the correct value
str2 = myFun("my_test2");
----------
----------
outf("%s",str) ---> here it gives some garbage value, statements in the middle doesn't edit this string in anyway.
このコードの何が問題なのか考えていますか?