Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thomasms/fortc
Fortran to C (and back again) examples
https://github.com/thomasms/fortc
bindings c cpp fortran iso modern-fortran
Last synced: about 2 months ago
JSON representation
Fortran to C (and back again) examples
- Host: GitHub
- URL: https://github.com/thomasms/fortc
- Owner: thomasms
- License: bsd-3-clause
- Created: 2022-03-14T20:29:46.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-03-14T21:19:09.000Z (almost 3 years ago)
- Last Synced: 2024-12-02T09:06:13.539Z (about 2 months ago)
- Topics: bindings, c, cpp, fortran, iso, modern-fortran
- Language: Fortran
- Homepage:
- Size: 12.7 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fortran to C API test
Fortran to C (and back again) examples. I get asked many times how can you call Fortran from C++ or from C and vice versa, well this is my example of how to do it.
## Error library
A very basic error library is written in C++ and we provide a C interface for it.This can be found in the `errorapi` directory.
## Input library
This illustrative (but nonsensical) library shows how to write functions in Fortran (modern) and bind to C.The implementation is found in the `fortranlib` directory.
The interface can be found in the `api` directory.Note that this Fortran implementation uses the C++ Error implementation through its C API.
## Example programs
Two stupid C++ programs are provided to show how to use this API via their corresponding C interfaces.
One tests for memory leaks: `memoryprogram`.
The other tests the error/logger: `testprogram`.
## More to do....
- [ ] Add Fortran program example
- [ ] Add C program example
- [ ] Setup some tests using toast## License
BSD-3-Clause LicenseWork of Thomas Stainer