Skip to content
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

Wrap C interface #1

Open
baggepinnen opened this issue Oct 31, 2024 · 0 comments
Open

Wrap C interface #1

baggepinnen opened this issue Oct 31, 2024 · 0 comments

Comments

@baggepinnen
Copy link
Owner

baggepinnen commented Oct 31, 2024

Strategy 1: C calls into Julia

  1. Write problem and solver settings into a JSON file
  2. Call the template engine Tera (Rust program) to have the templates expanded with the provided settings
  3. Create @ccallable julia functions for all functions that are expected by the expanded templates. These use jl_call or @cfunction to call into the julia runtime.
  4. Generate the required C main file with julia embedded.
  5. (optionally) use PackageCompiler or juliac to generate a shared-object file which the C program can call, instead of embedding a julia runtime into C.

Strategy 2: Julia calls C solver

  1. Generate julia bindings for the C interface using Clang.jl
  2. Generate higher-level julia wrapper functions that feel more like julia than C
  3. Write a function that initializes the required C structures
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant