[`-D scriptable`]: functions with raw pointer arguments or return type don't compile
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with the generated C++ snippets for -D scriptable and trace StackContext::runObject, StackContext::getObject, and StackContext::returnObject. Reproduce the raw-pointer and defined-type cases using hxvlc or hxdiscord_rpc, then inspect how generated wrappers pass and return values. Done means these signatures compile without invalid Dynamic-to-pointer or defined-type conversions.
Written by the indexing model from the issue text.
Description
I have noticed an issue when compiling a project with -D scriptable that uses hxvlc and hxdiscord_rpc.
Seemingly functions that have arguments that are raw pointers or a return type that is a raw pointer, don't compile.
Also functions that return a defined type from raw cpp code, also don't compile.
For example: It tries to cast Dynamic to void*, which isn't possible. The reason this happens is because it uses StackContext::runObject and StackContext::getObject return Dynamic.
generated cpp code snippets:
void* videoLock( void** planes ) {
if (__scriptVTable[140] ) {
::hx::CppiaCtx *__ctx = ::hx::CppiaCtx::getCurrent();
::hx::AutoStack __as(__ctx);
__ctx->pushObject(this);
__ctx->pushObject(planes);
return __ctx->runObject(__scriptVTable[140] ); // returns Dynamic, but we need void*
} else return Video_obj::videoLock(planes);return null();}
// ...
template<bool _HX_SUPER=false>
static void CPPIA_CALL __s_videoLock(::hx::CppiaCtx *ctx) {
ctx->returnObject( _HX_SUPER ? ((Video_obj*)ctx->getThis())->Video_obj::videoLock(ctx->getObject(sizeof(void*))) : ((Video_obj*)ctx->getThis())->videoLock(ctx->getObject(sizeof(void*))));
}
DiscordRichPresence buildPresence( ::Dynamic params ) {
if (__scriptVTable[6] ) {
::hx::CppiaCtx *__ctx = ::hx::CppiaCtx::getCurrent();
::hx::AutoStack __as(__ctx);
__ctx->pushObject(this);
__ctx->pushObject(params);
return __ctx->runObject(__scriptVTable[6] ); // returns Dynamic, but we need DiscordRichPresence
} else return DiscordClient_obj::buildPresence(params);return null();}
// ...
template<bool _HX_SUPER=false>
static void CPPIA_CALL __s_buildPresence(::hx::CppiaCtx *ctx) {
ctx->returnObject( _HX_SUPER ? ((DiscordClient_obj*)ctx->getThis())->DiscordClient_obj::buildPresence(ctx->getObject(sizeof(void*))) : ((DiscordClient_obj*)ctx->getThis())->buildPresence(ctx->getObject(sizeof(void*))));
}
- Dominant language
- C++
- Stars
- 330
- Forks
- 237
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 20
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from HaxeFoundation/hxcpp
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
HaxeFoundation/hxcpp#1217 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 18/100
HaxeFoundation/hxcpp#1470 · 4 comments ·
Maintainers usually reply within 1 day
-
bug regression
Difficulty 3/5 1-2 days Newbie friendliness 40/100
HaxeFoundation/hxcpp#1464 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 4/5 1-2 days Newbie friendliness 18/100
HaxeFoundation/hxcpp#1454 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
HaxeFoundation/hxcpp#1452 ·
Maintainers usually reply within 1 day
All issues in HaxeFoundation/hxcpp
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
-
Solution YAML loader rejects comments and blank lines before nested settingsPossibly taken @labishbardiya claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
RunanywhereAI/runanywhere-sdks#1345 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
CachyOS/packageinstaller#156 ·
Maintainers usually reply within 2 days