This PR adds the initial support of the C API implementation for interoperating with other programming languages, such as Fortran, Python, and Julia. The language linkage with key word extern "c" is used to enable the interfacing.
C API Design:
Conveys an uniform naming convention as specified here
Usage of macros and std::dynamic_pointer_cast to avoid code duplication
Changes:
Added header file include/ginkgo/c_api.h (define macros, declares function/structs) and source file core/c_api.cpp (concretize definitions of declared functions that internally calls ginkgo)
Necessary changes in CMake files cmake/install_helpers.cmake and core/CMakeLists.txt to include the C API
Example Usage:
Calling ginkgo from C through the C API can be seen here
The Julia package Ginkgo.jl calls ginkgo routines with ccall through the from Clang generated Julia side api.jl, which internally executes compiled dynamic libraries of ginkgo. It supports both locally compiled dynamic libraries or ones that are hosted under an artifact package ginkgo_jll.jl.
This PR adds the initial support of the C API implementation for interoperating with other programming languages, such as Fortran, Python, and Julia. The language linkage with key word
extern "c"
is used to enable the interfacing.C API Design:
std::dynamic_pointer_cast
to avoid code duplicationChanges:
include/ginkgo/c_api.h
(define macros, declares function/structs) and source filecore/c_api.cpp
(concretize definitions of declared functions that internally callsginkgo
)cmake/install_helpers.cmake
andcore/CMakeLists.txt
to include the C APIExample Usage:
ccall
through the from Clang generated Julia side api.jl, which internally executes compiled dynamic libraries of ginkgo. It supports both locally compiled dynamic libraries or ones that are hosted under an artifact package ginkgo_jll.jl.