Chapel: Feature Request: Primer on C / Chapel interoperability

Created on 11 Dec 2018  路  5Comments  路  Source: chapel-lang/chapel

I would find it very useful to see a complete example of calling Chapel modules / files / functions from C and linked from the Primers page.

There are a few things of particular interest

  1. Calling Chapel from C
  2. Passing matrices / arrays (sparse or dense) back and forth, perhaps with boost vectors on the C end.
  3. Importing full Chapel modules
  4. How to link to Chapel using CMake (maybe a find_chapel() macro?)
  5. Perhaps a github repo with a reference directory structure
Docs user issue

All 5 comments

Just to be sure, do you already know about https://chapel-lang.org/docs/technotes/libraries.html ?

I think this is a reasonable request. I probably won't get to it until closer to feature freeze, but definitely will before next release

Just to be sure, do you already know about https://chapel-lang.org/docs/technotes/libraries.html ?

Yes, I do, thanks for checking in! It seems much of this information is spread around and would be useufl to a crappy programmer like me to see it laid out in one place, especially on the matrix / vec ops.

"How do I always re-appear right before code freeze?" You ask. Talent, skill, dedication... :)

At least this time you are three months ahead of it! XD

I have a start of this over at this branch

Things that aren't covered yet:

  • [ ] extern records

    • [ ] with omitted fields

  • [ ] renaming extern symbols using the "external name" syntax
  • [ ] comments describing how to include the code that defines the extern symbols

    • [ ] via require statements

    • [ ] via the compile line command

  • [ ] types that are already available without the user having to write extern type declarations (i.e. c_int, etc)
  • [ ] passing arrays back and forth

    • [ ] c_ptr

    • [ ] c_array

    • [ ] chpl_external_array

    • [ ] chpl_opaque_array

  • [ ] update primers/README
  • [ ] update primers/Makefile
  • [ ] something similar for Python
  • [ ] something similar for Fortran
Was this page helpful?
0 / 5 - 0 ratings