-
-
Notifications
You must be signed in to change notification settings - Fork 353
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
sourcegen fails to process clib signature #1450
Comments
Hi @ischoegl, currently the C# side doesn't know what to do with the |
@burkenyo ... thanks for your response! The answer is probably not as clear-cut as it is platform dependent, see this SO post. In any case, @speth is likely a lot more knowledgeable in this area. PS: It's actually not super important that it would be a |
@ischoegl Just got a bit more info, it seems this “int*” is actually a bunch of references/handles to other Cantera objects, correct? My intuition is this will require hand-coding on the C# side anyway and not be scaffolded. I put a quick note in #1448: adding the function to the ignore list in the config.yaml is perfect. |
Aside: the reason this works in C# is because we have |
This is correct - it is a list of handles, where the length is passed as a separate PS: it just occurred to me that this is also the same as what is already done for interfacing with double arrays, see for example (never mind the missing CANTERA_CAPI int thermo_chemPotentials(int n, size_t lenm, double* murt); If there's a preference for |
@ischoegl, the C#-side has special wrapper classes for each of the Cantera handles that represent Cantera objects. So the interop function signature looks something like: [DllImport(LibFile)]
public static extern nuint thermo_nSpecies(ThermoPhaseHandle n);
Talked to @speth, and it seems all the “ I actually think the 32-bit ints are just fine, and the solution may be to change the .NET side to use these directly. The special framework class ( p.s. Marshalling is what the .NET world calls handling arguments to the native C types from the .NET types. So for example, the runtime can automatically convert a .NET |
@burkenyo … thanks for the explanations! |
Here's another CANTERA_CAPI int thermo_size(); |
Problem description
The following function signature causes a syntax error in sourcgen:
Steps to reproduce
Add function with signature and run GH CI (see #1448).
Fwiw, a similar signature in
ctonedim.h
(which is currently not included in .NET) will presumably fail also:Behavior
See GH Action
Relevant details from log
System information
main
Additional context
Bug emerged in #1448; as an aside, it would be terrific if the following could be updated:
cantera/interfaces/sourcegen/README.md
Line 36 in c3eb05c
The text was updated successfully, but these errors were encountered: