You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As described here, if you are using C++ you can get multiple instances of a model without having to add an explicit context parameter everywhere (I believe there was an attempted "C2" backend that tried this at some point). Currently I have to do a few hacks to make it work but it would be nice to have an official mode that supported this.
This requires a flag that changes the C output slightly:
Output no #includes at all.
Don't output #ifndef __cplusplus. I don't think that is actually necessary at all.
Sorry I didn't reply earlier. Yes I think this would be fine.
I do have a local branch that wraps the C code generator in a parameterised module, which makes it much easier to make the behavior configurable. Maybe I should push that first?
As described here, if you are using C++ you can get multiple instances of a model without having to add an explicit
context
parameter everywhere (I believe there was an attempted "C2" backend that tried this at some point). Currently I have to do a few hacks to make it work but it would be nice to have an official mode that supported this.This requires a flag that changes the C output slightly:
#includes
at all.#ifndef __cplusplus
. I don't think that is actually necessary at all.static
.void (*sail_rts_set_coverage_file)(const char *) = &sail_set_coverage_file;
.This allows creating independent model instances by wrapping the code in a struct or class like this:
Where
ModelRuntime
is a class that provides all of the C functions that the model expects.I think those would be fairly minimal changes to the compiler? Would it be ok if I added this feature?
The text was updated successfully, but these errors were encountered: