Autodesk / Autodesk/AutomaticComponentToolkit

[C++] Interfacewrapper.cpp compilation failure (string cache)

オープン
#148 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Go
スター
53
フォーク
26
PR マージ指標
30日以内にマージされた PR はありません

説明

Given a function with a class / optionalclass argument, the generated code ends up looking something like this:

interfacewrapper.cpp
```c++
std::string sName("");
IBase* pBaseThisResult(nullptr);
IFoo* pIFoo = dynamic_cast(pIBaseClass);
if (!pIFoo)
throw EMyComponentInterfaceException(MYCOMPONENT_ERROR_INVALIDCAST);
bool isCacheCall = (pNameBuffer == nullptr);
if (isCacheCall) {
pBaseThisResult = pIFoo->GetProperties(sName, *pBar);
pIFoo->_setCache (new ParameterCache_3 (sName, *pBar, pBaseThisResult));
}
else {
auto cache = dynamic_cast*> (pIFoo->_getCache ());
if (cache == nullptr)
throw EMyComponentInterfaceException(MYCOMPONENT_ERROR_INVALIDCAST);
cache->retrieveData (sName, *pBar, pBaseThisResult);
pIFoo->_setCache (nullptr);
}
```

Since ` CMyComponentFoo` is a binding class, this won't compile. Also, the pointer `pBaseThisResult` is actually of type `IBase *`.

I've hacked a fix to get it to work by generating `IBase *` instead, but as I don't know how this parameter caching is supposed to work I can't say if it's the right way to fix it.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start with the generated interfacewrapper.cpp example and inspect how parameter caching handles class or optionalclass arguments. Trace the types used for pBaseThisResult, ParameterCache_3, and the binding class CMyComponentFoo, then verify the generated wrapper compiles and that the cache path still behaves correctly.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
cpp
領域
tooling
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。