emscripten-core / emscripten-core/emscripten

octet[] evaluated to char rather than char* for argument list in C++ Glue code

Open
#14,827 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

Hello,

The issue stems from the implementation of the type_to_cdec function. Since octet does not match any interface types, type_to_cdec will return const char given that input, ignoring the fact that it is an array type. It seems as though the current implementation of type_to_cdec will only append a * in order to allow for declaration of interface pointers, and this does not account for other types which the grammar allows to be arrays.

For example, the idl code attached (extension changed from idl due to github supported file extensions) will generate glue code with a function argument with type const unsigned char rather than const unsigned char*
[example.txt](https://github.com/emscripten-core/emscripten/files/6956287/example.txt)

Is it intentional for arrays to be barred as argument types or should we look to implement a workaround for this?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.