{"id":40669086,"url":"https://github.com/csiro-hydroinformatics/c-interop","last_synced_at":"2026-01-21T09:17:58.547Z","repository":{"id":62562227,"uuid":"81705274","full_name":"csiro-hydroinformatics/c-interop","owner":"csiro-hydroinformatics","description":"Reusable functions for marshalling data between C, C++ and other programming languages","archived":false,"fork":false,"pushed_at":"2025-06-16T06:05:54.000Z","size":351,"stargazers_count":1,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-10T06:42:45.775Z","etag":null,"topics":["glue-code","interop","interoperability","marshalling-data","python","rcpp"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/csiro-hydroinformatics.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-02-12T05:30:31.000Z","updated_at":"2025-06-16T06:05:58.000Z","dependencies_parsed_at":"2025-01-13T04:25:54.557Z","dependency_job_id":"2bd4f3d0-6898-4be5-ac29-33a72f76372d","html_url":"https://github.com/csiro-hydroinformatics/c-interop","commit_stats":{"total_commits":169,"total_committers":2,"mean_commits":84.5,"dds":0.08875739644970415,"last_synced_commit":"4c7a76a6371aeb8b7d4d42306236c5aa10f31200"},"previous_names":["csiro-hydroinformatics/rcpp-interop-commons"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/csiro-hydroinformatics/c-interop","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csiro-hydroinformatics%2Fc-interop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csiro-hydroinformatics%2Fc-interop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csiro-hydroinformatics%2Fc-interop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csiro-hydroinformatics%2Fc-interop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csiro-hydroinformatics","download_url":"https://codeload.github.com/csiro-hydroinformatics/c-interop/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csiro-hydroinformatics%2Fc-interop/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28630946,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T04:47:28.174Z","status":"ssl_error","status_checked_at":"2026-01-21T04:47:22.943Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["glue-code","interop","interoperability","marshalling-data","python","rcpp"],"created_at":"2026-01-21T09:17:58.470Z","updated_at":"2026-01-21T09:17:58.530Z","avatar_url":"https://github.com/csiro-hydroinformatics.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Reusable functions for marshalling data between C, C++ and other programming languages\n\n[![license](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/csiro-hydroinformatics/c-interop/blob/master/LICENSE.txt)\n![status](https://img.shields.io/badge/status-beta-blue.svg)\n[![Python package doc](https://readthedocs.org/projects/cinterop/badge/?version=latest)](https://cinterop.readthedocs.io/en/latest/?badge=latest)\n\n**Python package**: [![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/csiro-hydroinformatics/c-interop/blob/master/bindings/python/cinterop/LICENSE.txt) ![status](https://img.shields.io/badge/status-beta-blue.svg) [![Documentation Status](https://readthedocs.org/projects/cinterop/badge/?version=latest)](https://cinterop.readthedocs.io/en/latest/?badge=latest) [![codecov](https://codecov.io/gh/csiro-hydroinformatics/c-interop/branch/master/graph/badge.svg?token=Bxg1zkbG9G)](https://codecov.io/gh/csiro-hydroinformatics/c-interop) master: [![Python package](https://github.com/csiro-hydroinformatics/c-interop/actions/workflows/python-cinterop.yml/badge.svg?branch=master)](https://github.com/csiro-hydroinformatics/c-interop/actions/workflows/python-cinterop.yml) testing: [![Python package](https://github.com/csiro-hydroinformatics/c-interop/actions/workflows/python-cinterop.yml/badge.svg?branch=testing)](https://github.com/csiro-hydroinformatics/c-interop/actions/workflows/python-cinterop.yml)\n\n## Purpose and context\n\nThis repository contains reusable material for interoperability between C/C++ and other languages such as python, R, etc. It is using template-only C++, avoiding code duplications across several projects. The code design also stems from learning over the years to prevent some \"gotchas\" one can get into when diving deep in native interop accross compilation modules.\n\n## Content\n\nThe `C++` header files cover interop for:\n\n* common base types (characters, numeric, and vectors thereof)\n* boost date-time\n* time series (inherited from its usage in time step modelling systems)\n\nThe repo also includes interop packages for several higher level languages, that helps handling consistently (including memory management...) some of the data stemming from the C/C++ glue code:\n\n* python package [cinterop](./bindings/python/cinterop/), also [available on pypi](https://pypi.org/project/cinterop/)\n* R package [cinterop](./bindings/R/pkgs/cinterop/)\n* Matlab [reference counting helpers](./bindings/matlab/)\n\n## Related work, use cases\n\nOne use case arising from hydrologic forecasting is [uchronia-time-series](https://github.com/csiro-hydroinformatics/uchronia-time-series/).\n\nSome features in the present repository depend on related material:\n\n* [moirai](https://github.com/csiro-hydroinformatics/moirai), a C++ library designed to help handling C++ objects from so-called opaque pointers, via a C API.\n* The python package [refcount](https://github.com/csiro-hydroinformatics/pyrefcount) for reference counting external resources.\n\nAnother resource is a [blog post](https://jmp75.github.io/work-blog/posts/2022-09-03-c-api-wrapper-generation.html) on generating programming language bindings to a C API.\n\n## Example\n\nFor instance this library defines a template function `to_custom_character_vector` to convert C `char**` types to something useful for the higher level language at hand.\n\n```c++\nnamespace cinterop\n{\n    namespace utils\n\t{\n        template\u003ctypename T\u003e\n\t\tT to_custom_character_vector(char** names, int size, bool cleanup);\n```\n\nOne specialization of this is a conversion to Rcpp's `CharacterVector` type for interop with R, which would be used like this:\n\n```c++\nint size;\nchar** values = GetEnsembleDatasetDataIdentifiers(dataLibrary-\u003eget(),  \u0026size);\nCharacterVector cv = to_custom_character_vector\u003cCharacterVector\u003e(values, size, true);\n```\n\n## Related work\n\n* [native interop glue code generation](https://github.com/csiro-hydroinformatics/c-api-wrapper-generation)\n* An R package pupetting the former - I have yet to open source it though.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsiro-hydroinformatics%2Fc-interop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsiro-hydroinformatics%2Fc-interop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsiro-hydroinformatics%2Fc-interop/lists"}