-
Notifications
You must be signed in to change notification settings - Fork 781
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linker failures when building mruby as C++ #5818
Comments
Hmm, those functions are internal functions so that they should not be accessed from outside |
I think that direct compilation as C++ is limited to the https://github.com/artichoke/artichoke/blob/lopopolo/c-unwind-mrb_raise-panic/artichoke-backend/build.rs is The mruby build system normally compiles as C, even with
The following is a possible solution on the artichoke side. Change the build system of artichoke to mimic part of the mruby build system. Files that need C++ compilation can be checked with % git grep --name-only -w -e MRB_TRY --or -e MRB_THROW -- '*.c'
mrbgems/mruby-compiler/core/codegen.c
mrbgems/mruby-compiler/core/y.tab.c
src/error.c
src/gc.c
src/vm.c |
thanks for the context @dearblue. When using |
Yes, I checked the command with The The actual flags for each compiler are defined in the tool chain. |
I worked around my issues by modifying the source in lieu of using mruby's code generated CXX stubs. |
I am attempting to compile mruby as C++ with clang to make use of the
MRB_USE_CXX_EXCEPTION
compile time macro.I am encountering several linker failures. Spot checking some of these errors, they appear to be functions defined in a
.c
implementation file without a corresponding header declaration, which are then declared in another.c
implementation file.If a function is to be declared in a
.c
implementation file without a header, I believe the declaration needs to be surrounded with:Additionally, most (all?) mrbgems implementation files are not wrapped with
extern "C"
blocks which means the dynamically generated code to init and finalize mrbgems will not link.Example
mrb_f_send
Implementation
mruby/src/vm.c
Lines 671 to 675 in 1bec339
Function Declarations
mruby/src/class.c
Lines 2894 to 2895 in 1bec339
mruby/mrbgems/mruby-metaprog/src/metaprog.c
Lines 634 to 635 in 1bec339
Linker Failures
Error log
The text was updated successfully, but these errors were encountered: